Javac flag disadvantages -parameters

I want to try some framework functions that require parameter names at runtime, so I need to compile my application with -parametersand it will save the parameter names in the JVM bytecode.

What disadvantages besides the jar / war size exist in using this parameter?

+4
source share
2 answers

Adding parameter names to the class file format is covered by JEP 118 , which was delivered in Java 8. There was little discussion of why the inclusion of parameter names was made optional in OpenJDK email messages here and. Briefly, the reasons given for the optional selection of parameters are questions about the class file size, compatibility surface, and exposure to confidential information.

. , . , JVM . , , JVM. .

. (, , .) , . , , , . , , , , ( ).

Jackson ( JSON), , JSON. , , , JSON . , JSON Java, . , , , , , , .

+8

- .class, , - :

public class DeleteMe3 {
    public static void main(String[] args) {
    }

    private static void go(String s) {
    }
}

, , :

private static void go(java.lang.String);
   descriptor: (Ljava/lang/String;)V
   flags: ACC_PRIVATE, ACC_STATIC
   Code:
     stack=0, locals=1, args_size=1
       0: return
     LineNumberTable:
       line 11: 0
   MethodParameters:
     Name                           Flags
     s

MethodParameters -parameters.

, . Spring JPA . , ( - ).

+2

Source: https://habr.com/ru/post/1677533/


All Articles