Community
Participate
Working Groups
The class file editor uses a non-standard modifier order. For instance, final public class java.lang.System extends java.lang.Object { final public static java.io.InputStream in; native private static void registerNatives(); ... It should instead read: public final class java.lang.System extends java.lang.Object { public static final java.io.InputStream in; private static native void registerNatives(); ... So says the Java Language Spec: Section 8.1.1 http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#21613 "ClassModifier: one of public protected private abstract static final strictfp [...] If two or more class modifiers appear in a class declaration, then it is customary, though not required, that they appear in the order consistent with that shown above in the production for ClassModifier." Section 8.3.1 http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78091 "FieldModifier: one of public protected private static final transient volatile [...] If two or more (distinct) field modifiers appear in a field declaration, it is customary, though not required, that they appear in the order consistent with that shown above in the production for FieldModifier." Section 8.4.3 http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78188 "MethodModifier: one of public protected private abstract static final synchronized native strictfp [...] If two or more method modifiers appear in a method declaration, it is customary, though not required, that they appear in the order consistent with that shown above in the production for MethodModifier."
It's the editor which shows up when no source is attached. Decreasing severity to 'minor'.
This is provided by the Disassembler: String content= null; int flags= IClassFileReader.FIELD_INFOS | IClassFileReader.METHOD_INFOS | IClassFileReader.SUPER_INTERFACES | IClassFileReader.METHOD_BODIES; IClassFileReader classFileReader= ToolFactory.createDefaultClassFileReader(classFile, flags); if (classFileReader != null) { IClassFileDisassembler disassembler= ToolFactory.createDefaultClassFileDisassembler(); content= disassembler.disassemble(classFileReader, "\n"); //$NON-NLS-1$ }
Created attachment 17335 [details] Reorder the modifiers and a bit of clean-up Reordered the modifiers according to JLS. Cleaned the code a bit by extracting a common routine.
I will review it. Thanks for the patch.
Fixed and released in HEAD. Updated existing regression tests.
Verified in I20050215-2300