Summary: | [JDK9] ajc$preClinit not allowed in static initializer | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Cleber Muramoto <cleber.muramoto> |
Component: | Compiler | Assignee: | aspectj inbox <aspectj-inbox> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | blocker | ||
Priority: | P3 | CC: | aclement |
Version: | DEVELOPMENT | ||
Target Milestone: | 1.9.0.RC1 | ||
Hardware: | PC | ||
OS: | Linux | ||
Whiteboard: |
Description
Cleber Muramoto
2017-05-06 15:35:09 EDT
Anyone awaiting for this fix, can work-around by patching aspectjtools.jar with a trivial change in org.aspectj.weaver.bcel.LazyClassGen public Field getTjpField(BcelShadow shadow, final boolean isEnclosingJp) { Field tjpField = tjpFields.get(shadow); if (tjpField != null) { return tjpField; } int modifiers = Modifier.STATIC /*| Modifier.FINAL*/ ; ... } Another similar issue when ajc compiles aspects themselves. AJC produces ajc$perSingletonInstance as static final field and ajc$postClinit attempts to initialize it. Quick Hack: Patch org.aspectj.weaver.AjcMemberMaker public static ResolvedMember perSingletonField(UnresolvedType declaringType) { return new ResolvedMemberImpl(Member.FIELD, declaringType, PUBLIC_STATIC, NameMangler.PERSINGLETON_FIELD_NAME, declaringType.getSignature()); } Fixed up (well mostly). Removed the final modifier. Unfortunately that doesn't help the case of weaving default methods in an interface since you can't take the final off in that case (and the preclinit will need inlining). But I think that is a much smaller issue than the general problem. So will capture it separately (address it when someone starts hitting it). |