-
Enhancement
-
Resolution: Fixed
-
P3
-
13
-
b27
the javac ClassWriter class provides a method writeExtraClassAttributes as follows
/**Allows subclasses to write additional class attributes
*
* @return the number of attributes written
*/
protected int writeExtraClassAttributes(ClassSymbol c) {
return 0;
}
The method has various problems:
1. It can be hard to provide subtypes in a modular javac
2. The field `databuf` is package-private, implying that subtypes would have to be in the same package, which again is problematic in a modular javac
3. It is unnecessarily restricted to class-level attributes. It would be more useful if it could be extended to field and method attributes as well
It would be better if a client could register to be called in a timely fashion to be able to write additional class, method, and field attributes.
/**Allows subclasses to write additional class attributes
*
* @return the number of attributes written
*/
protected int writeExtraClassAttributes(ClassSymbol c) {
return 0;
}
The method has various problems:
1. It can be hard to provide subtypes in a modular javac
2. The field `databuf` is package-private, implying that subtypes would have to be in the same package, which again is problematic in a modular javac
3. It is unnecessarily restricted to class-level attributes. It would be more useful if it could be extended to field and method attributes as well
It would be better if a client could register to be called in a timely fashion to be able to write additional class, method, and field attributes.
- relates to
-
JDK-8235621 Replace use of Function<?,Integer> with ToIntFunction
-
- Resolved
-
-
JDK-8033412 javac Plugins should have access to generated classfiles
-
- Open
-