[OpenJDK 2D-Dev] Review Request: JDK-8000406 - change files using @GenerateNativeHeader to use @Native

Phil Race philip.race at oracle.com
Tue Apr 2 12:37:05 PDT 2013

The addition of @Native to various lines in SunGraphics2D.java look to 
have pushed them >80 chars
and it looks to me as if previously the author took some care to limit 
it. Moreover the indentation
of the comment block `on lines 127-130 is no longer aligned.

Maybe it would be easier for that case to put the annotation on the line 
above as in
static final int FOO ...

Otherwise looks OK, looks like you found files that had 
@GenerateNativeHeaders that
didn't need it and cleaned those up, and in native sources removed 
unneeded header
file imports too.

I do have a background question about how it works.
There is an implication here that only the constants with @native might
be included in generated header files. Is that true ?

Whereas if a class has native method declarations, then  it doesn't need
these annotations, but you get all constants in the header file. Is that 
right ?


On 4/1/13 3:16 PM, Dan Xu wrote:
> Hi All,
> In this fix, I have updated files in JDK libraries to use @Native 
> annotation instead of @GenerateNativeHeader  to mark classes that 
> contain no native methods but constants used by native codes.
> @GenerateNativeHeader was added earlier in the development for 
> JDK8."This has proved problematic for some core classes with respect 
> to Jigsaw, since the use of such an annotation creates a compile-time 
> dependency from the base module to the module containing javax.tools, 
> and the base module should not have any dependencies." After switching 
> to @Native annotation, the dependency problem will be solved as 
> java.lang.annotation.Native is in the proposed base module. In 
> addition, the annotation has been refined not to be on the class level 
> but on the constants themselves, which also makes the generated header 
> files much cleaner.
> This effort is part of JDK-8000404. After jdk libraries uptaking the 
> annotation changes, @GenerateNativeHeader annotation will be removed 
> completely.
> CCC: http://ccc.us.oracle.com/8000404
> webrev: http://cr.openjdk.java.net/~dxu/8000406/webrev/
> Thanks for your feedback!
> -Dan

More information about the macosx-port-dev mailing list