EVALUATION
The problem is actually in javac, not javah per se.
Fundamentally, the problem is in javac ClassReader, which is not correctly reading the saved parameter names. It reads too few names, which causes an NPE in MethodSymbol when using iterators to correlate the list of names with the list of parameters.
There are many things wrong in the ClassReader code:
1) the main reason causing the observed NPE is that the name reading code does not take into account the adjustment to the MethodType in readMethod to ignore the synthetic parameter this$0. Given this error, it then fails to correctly match up names to parameters.
2) the name reading code assumes a single LocalVariableTable (which is not required)
3) the name reading code assumes that all the parameters are named (which is not required)
4) the name reading code assumes that the parameters are named in order (which is not required)
These are all long-standing issues and not the result of any recent changes. The issue with javah is just that by using annotation processing, it is tickling these bugs in ClassReader.
|
SUGGESTED FIX
When the time comes, part of this fix needs to be removing the
workaround added to jdk/make/common/shared/Defs-java.gmk
under 6888888:
*** 163,172 ****
--- 163,177 ----
JAVAH_CMD = $(JAVA_TOOLS_DIR)/javah \
$(JAVAHFLAGS)
JAVADOC_CMD = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%)
endif
+ #always use the bootstrap javah until bug-ID 6889255 is fixed. These
+ #five lines should be removed as part of that fix:
+ JAVAH_CMD = $(JAVA_TOOLS_DIR)/javah \
+ $(JAVAHFLAGS)
+
# Override of what javac to use (see deploy workspace)
ifdef JAVAC
JAVAC_CMD = $(JAVAC)
endif
|