(original) (raw)
Hi Phil,Thank you for your good comments. Please see my answers below.
I use a program to automatically scan and modify files. And the length program is not noticed. I will fix the format issue.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
@Native
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 ?
If a class has native method declarations, then we don't need add anything. It will automatically generate the header file with all constants.
If a class contains no native methods but have constants interested by native codes, then we need annotations. Previously, we use @GenerateNativeHeader. But now we need replace them with @Native. @Native works on the field level. Only constants annotated with @native will be added as an entry in the generated native header file. (But we currently have a bug on this. It generates a header file with all constants no matter a constant has @Native or not. It will be fixed soon.)
In my change, I only add @Native annotation to constants interested by native codes. And if no such kind of constants and native methods declared, the fix does the clean-up and removes unnecessary header imports. Thanks!
\-Dan
-phil.
On 4/1/13 3:16 PM, Dan Xu wrote:
Hi All,
In this fix, I have updated filesin 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 proposedbase module. In
addition, the annotation has been
refined not to be on the class level but
on the constantsthemselves, which
also makes the
generated header
files much
cleaner.
Thiseffort is part
of JDK-8000404.
After jdk
libraries
uptaking the annotationchanges,
@GenerateNativeHeaderannotation
will be
removed
completely.
CCC:http://ccc.us.oracle.com/8000404
webrev:http://cr.openjdk.java.net/~dxu/8000406/webrev/
Thanksfor your
feedback!
-Dan