Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6852371

different behavior to get static inf. of internal class between jdk5 and 6

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 5.0u18
    • tools
    • apt
    • x86
    • windows_xp

      When a customer uses apt command in jdk5 and sets a java source file which includes internal class to the argument, annotationProcessor returns the information of "static" of the internal class.

      Example)
      public class TempImpl2 {

          @CosmiService
          public static class TempImpl2Internal {
              public int addNumbers(int number1) {
                  return number1++;
              }
          }
      }

      In the above program, annotation processor returns the informtion of TempImpl2Internal class.

      On the other hand, when the user compiles the same .java source program and sets the compiled class file name with -XclaassesAsDecls option, annotation processor does not return the information.

      This problem occurs in jdk5ux, but not in jdk6ux.

      TEST PROGRAM:
      "apt-test-env.zip" is attached. There are 2 directories, test1_java and test2_class under apt_test dir. test1_java is the environment which specifies java source file to apt command. test2_class is the environment which specifies compiled class file name to apt command.

      REPRODUCTION:
      The following shows how to reproduce in Windows.
      The target files which should be editted are "*.bat" files.
      If in Solaris or linux, please edit "*.csh" files.

      1. test1_java
      (1) set jdk5 path name to the environment variable JDK_PATH
      (2) execute make_ap.bat
          This will compile CosmiService.java and ListClassApf.java
      (3) execute go_apt.bat
          This will execute apt command for TempImple2.java and print the information of TempImple2 class.

      2. test2_class
      (1) set jdk5 path name to the environment variable JDK_PATH
      (2) execute make_ap.bat
          This will compile CosmiService.java and ListClassApf.java
      (3) execute compile.bat
          This will compile TempImple2.java
      (4) execute go_apt_class.bat
          This will execute apt command for TempImple2$TempImpl2Internal.class and print the information of TempImple2$TempImple2Internal class.

      RESULT :
      test1_java environment outputs the information to "result.txt" file as follwos.

      com.example.impl.TempImpl2
      ##### Modifier.PUBLIC YES #####
      ##### Modifier.FINAL NO #####
      ##### Modifier.ABSTRACT NO #####
      ##### Modifier.STATIC NO #####
      com.example.impl.TempImpl2.TempImpl2Internal
      ##### Modifier.PUBLIC YES #####
      ##### Modifier.FINAL NO #####
      ##### Modifier.ABSTRACT NO #####
      ##### Modifier.STATIC YES ##### <=== This shows the "static" inf. of TempImpl2Internal

      As to test2_class, the following will be output.

      com.example.impl.TempImpl2.TempImpl2Internal
      ##### Modifier.PUBLIC YES #####
      ##### Modifier.FINAL NO #####
      ##### Modifier.ABSTRACT NO #####
      ##### Modifier.STATIC NO ##### <=== This shows the "static" inf. of TempImpl2Internal can not be gotten.

      NOTE:
       JDK6u13 can get the TempImpl2.TempImpl2Internal information both in test1_java and test2_class.

            darcy Joe Darcy
            tbaba Tadayuki Baba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: