Community
Participate
Working Groups
Build Identifier: 1.6.10 Whenever -XaddSerialVersionUID is added in order to avoid serialization/marshalling issues NullPointerException is risen from AspectJ when accessing thisJoinPointStaticPart. After reviewing the woven class, you perceive that SJPs are never initialized, and only serialVersionUID is filled at ajc$preClinit method. The problem is located at: private void addAjcInitializers() { if (tjpFields.size() == 0 && !serialVersionUIDRequiresInitialization) { return; } InstructionList[] il = null; if (tjpFields.size() > 0) { il = initializeAllTjps(); } if (serialVersionUIDRequiresInitialization) { if (il == null) { il = new InstructionList[1]; } il[0] = new InstructionList(); il[0].append(InstructionFactory.PUSH(getConstantPool(), calculatedSerialVersionUID)); il[0].append(getFactory().createFieldAccess(getClassName(), "serialVersionUID", BasicType.LONG, Constants.PUTSTATIC)); } As you can see the instructionList is overwritten when serialVersionUID is added and thus SJPs deleted and never injected. Next message I will upload reprocase + patch. Thanks and regards. Reproducible: Always Steps to Reproduce: 1.add -XaddSerialVersionUID to the aop.xml 2.use thisJoinPointStaticPart at any place 3.NPE is got
Created attachment 187918 [details] TestCase
Created attachment 187919 [details] Patch
Applied tests patch - moved tests from 1.6.10 area to 1.6.11 Applied code patch - unfortunately broke existing tests as it didn't allow for the case where there are no tjp fields (il==null going into the new logic, triggers an NPE). Guarded for that case. All committed. Thanks for the contribution!