Kohsuke Kawaguchi edited a comment on Bug JENKINS-22525

As for ItemList not in the InnerClasses attribute, I'm discovering with the following test case that if a nested/inner class is marked as private, it does not get recorded in the InnerClasses attribute:

public class App 
{
    private static class Foo {}
    private class Bar {}

    static class Alpha {}
    class Bravo {}

    public static void main( String[] args )
    {
        System.out.println(Foo.class.getEnclosingClass());
        System.out.println(Bar.class.getEnclosingClass());

        System.out.println(Alpha.class.getEnclosingClass());
        System.out.println(Bravo.class.getEnclosingClass());
    }
}
Classfile /files/kohsuke/ws/jenkins/investigations/JENKINS-22525/jenkins22525/target/classes/test/App.class
  Last modified Jul 31, 2014; size 1158 bytes
  MD5 checksum 264ed3611a578e1a4c8e2d4e0ea8b378
  Compiled from "App.java"
public class test.App
  SourceFile: "App.java"
  InnerClasses: 
       #11= #8 of #9; //Bravo=class test/App$Bravo of class test/App
       static #13= #7 of #9; //Alpha=class test/App$Alpha of class test/App
  RuntimeInvisibleAnnotations:
    0: #57()
  minor version: 0
  major version: 49
  flags: ACC_PUBLIC, ACC_SUPER

Classfile /files/kohsuke/ws/jenkins/investigations/JENKINS-22525/jenkins22525/target/classes/test/App$Foo.class
  Last modified Jul 31, 2014; size 303 bytes
  MD5 checksum 3f4b082e8d8c5cbf85d4afeb7807b253
  Compiled from "App.java"
class test.App$Foo
  SourceFile: "App.java"
  minor version: 0
  major version: 49
  flags: ACC_SUPER

Classfile /files/kohsuke/ws/jenkins/investigations/JENKINS-22525/jenkins22525/target/classes/test/App$Alpha.class
  Last modified Jul 31, 2014; size 309 bytes
  MD5 checksum df99610f5b28798c5f07f308b749df89
  Compiled from "App.java"
class test.App$Alpha
  SourceFile: "App.java"
  InnerClasses: 
       static #10= #2 of #16; //Alpha=class test/App$Alpha of class test/App
  minor version: 0
  major version: 49
  flags: ACC_SUPER

This seems to violate JVM spec of the InnerClass attribute. J9 VM accepts this without reporting an error. In this case I don't understand how JVM can correctly determine that App$Foo has an enclosing class. From the byte code, there's no way to distinguish this vs compiling the following class:

class App {}
class App$Foo {} // '$' is a legal character in a class name in Java
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to