Skip to content

Commit

Permalink
Fix preservation again after adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Aug 31, 2018
1 parent b33b538 commit 9f33ae7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
Expand Up @@ -4154,22 +4154,20 @@ protected void onVisitEnd() {
typeDescription.getSimpleName(), typeDescription.getSimpleName(),
typeDescription.getModifiers()); typeDescription.getModifiers());
} }
MethodDescription.InDefinedShape outerMethod = instrumentedType.getEnclosingMethod(); MethodDescription.InDefinedShape enclosingMethod = instrumentedType.getEnclosingMethod();
if (outerMethod != null) { if (enclosingMethod != null) {
cv.visitInnerClass(instrumentedType.getInternalName(), cv.visitInnerClass(instrumentedType.getInternalName(),
NO_REFERENCE, NO_REFERENCE,
instrumentedType.isAnonymousType() instrumentedType.isAnonymousType()
? NO_REFERENCE ? NO_REFERENCE
: instrumentedType.getSimpleName(), : instrumentedType.getSimpleName(),
instrumentedType.getModifiers()); instrumentedType.getModifiers());
} else { } else {
TypeDescription outerType = instrumentedType.getDeclaringType() == null TypeDescription declaringType = instrumentedType.getDeclaringType();
? instrumentedType.getDeclaringType() if (declaringType != null) {
: instrumentedType.getEnclosingType();
if (outerType != null) {
cv.visitInnerClass(instrumentedType.getInternalName(), cv.visitInnerClass(instrumentedType.getInternalName(),
instrumentedType.isMemberType() instrumentedType.isMemberType()
? outerType.getInternalName() ? declaringType.getInternalName()
: NO_REFERENCE, : NO_REFERENCE,
instrumentedType.isAnonymousType() instrumentedType.isAnonymousType()
? NO_REFERENCE ? NO_REFERENCE
Expand Down Expand Up @@ -4760,22 +4758,19 @@ protected UnresolvedType create(TypeInitializer typeInitializer) {
typeDescription.getSimpleName(), typeDescription.getSimpleName(),
typeDescription.getModifiers()); typeDescription.getModifiers());
} }
MethodDescription.InDefinedShape outerMethod = instrumentedType.getEnclosingMethod(); if (enclosingMethod != null) {
if (outerMethod != null) {
classVisitor.visitInnerClass(instrumentedType.getInternalName(), classVisitor.visitInnerClass(instrumentedType.getInternalName(),
NO_REFERENCE, NO_REFERENCE,
instrumentedType.isAnonymousType() instrumentedType.isAnonymousType()
? NO_REFERENCE ? NO_REFERENCE
: instrumentedType.getSimpleName(), : instrumentedType.getSimpleName(),
instrumentedType.getModifiers()); instrumentedType.getModifiers());
} else { } else {
TypeDescription outerType = instrumentedType.getDeclaringType() == null TypeDescription declaringType = instrumentedType.getDeclaringType();
? instrumentedType.getDeclaringType() if (declaringType != null) {
: instrumentedType.getEnclosingType();
if (outerType != null) {
classVisitor.visitInnerClass(instrumentedType.getInternalName(), classVisitor.visitInnerClass(instrumentedType.getInternalName(),
instrumentedType.isMemberType() instrumentedType.isMemberType()
? outerType.getInternalName() ? declaringType.getInternalName()
: NO_REFERENCE, : NO_REFERENCE,
instrumentedType.isAnonymousType() instrumentedType.isAnonymousType()
? NO_REFERENCE ? NO_REFERENCE
Expand Down
Expand Up @@ -1210,8 +1210,8 @@ public String getSimpleName() {
.load(getClass().getClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST.opened()) .load(getClass().getClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST.opened())
.getLoaded(); .getLoaded();
Class<?> type = createPlainWithoutValidation() Class<?> type = createPlainWithoutValidation()
.innerTypeOf(outer)
.name(sample.getName()) .name(sample.getName())
.innerTypeOf(outer)
.make() .make()
.load((InjectionClassLoader) outer.getClassLoader(), InjectionClassLoader.Strategy.INSTANCE) .load((InjectionClassLoader) outer.getClassLoader(), InjectionClassLoader.Strategy.INSTANCE)
.getLoaded(); .getLoaded();
Expand Down Expand Up @@ -1271,8 +1271,8 @@ public String getSimpleName() {
.load(getClass().getClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST.opened()) .load(getClass().getClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST.opened())
.getLoaded(); .getLoaded();
Class<?> type = createPlainWithoutValidation() Class<?> type = createPlainWithoutValidation()
.innerTypeOf(outer.getConstructor())
.name(sample.getName()) .name(sample.getName())
.innerTypeOf(outer.getConstructor())
.make() .make()
.load((InjectionClassLoader) outer.getClassLoader(), InjectionClassLoader.Strategy.INSTANCE) .load((InjectionClassLoader) outer.getClassLoader(), InjectionClassLoader.Strategy.INSTANCE)
.getLoaded(); .getLoaded();
Expand Down Expand Up @@ -1316,8 +1316,8 @@ public void visit(int version, int access, String name, String signature, String
}; };
} }
}) })
.nestHost(outer)
.name(sample.getName()) .name(sample.getName())
.nestHost(outer)
.make() .make()
.load((InjectionClassLoader) outer.getClassLoader(), InjectionClassLoader.Strategy.INSTANCE) .load((InjectionClassLoader) outer.getClassLoader(), InjectionClassLoader.Strategy.INSTANCE)
.getLoaded(); .getLoaded();
Expand Down

0 comments on commit 9f33ae7

Please sign in to comment.