HHH-16711 Ensure static accessor methods for accessing foreign package state use visible types
This commit is contained in:
parent
2076fc0976
commit
28043f8fc4
|
@ -324,23 +324,14 @@ public class BytecodeProviderImpl implements BytecodeProvider {
|
||||||
getterType = ( (Method) getter ).getReturnType();
|
getterType = ( (Method) getter ).getReturnType();
|
||||||
}
|
}
|
||||||
|
|
||||||
builder = builder.define(
|
builder = builder.defineMethod(
|
||||||
new MethodDescription.InDefinedShape.Latent(
|
"get_" + getter.getName(),
|
||||||
builder.toTypeDescription(),
|
TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(
|
||||||
new MethodDescription.Token(
|
getterType
|
||||||
"get_" + getter.getName(),
|
),
|
||||||
Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC,
|
Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
|
||||||
TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(
|
|
||||||
getterType
|
|
||||||
),
|
|
||||||
Collections.singletonList(
|
|
||||||
TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(
|
|
||||||
clazz
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
.withParameter( foreignPackageClassInfo.clazz )
|
||||||
.intercept(
|
.intercept(
|
||||||
new Implementation.Simple(
|
new Implementation.Simple(
|
||||||
new GetFieldOnArgument(
|
new GetFieldOnArgument(
|
||||||
|
@ -358,24 +349,13 @@ public class BytecodeProviderImpl implements BytecodeProvider {
|
||||||
setterType = ( (Method) setter ).getParameterTypes()[0];
|
setterType = ( (Method) setter ).getParameterTypes()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
builder = builder.define(
|
builder = builder.defineMethod(
|
||||||
new MethodDescription.InDefinedShape.Latent(
|
"set_" + setter.getName(),
|
||||||
builder.toTypeDescription(),
|
TypeDescription.Generic.VOID,
|
||||||
new MethodDescription.Token(
|
Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
|
||||||
"set_" + setter.getName(),
|
|
||||||
Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC,
|
|
||||||
TypeDescription.Generic.VOID,
|
|
||||||
Arrays.asList(
|
|
||||||
TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(
|
|
||||||
clazz
|
|
||||||
),
|
|
||||||
TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(
|
|
||||||
setterType
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
.withParameter( foreignPackageClassInfo.clazz )
|
||||||
|
.withParameter( setterType )
|
||||||
.intercept(
|
.intercept(
|
||||||
new Implementation.Simple(
|
new Implementation.Simple(
|
||||||
new SetFieldOnArgument(
|
new SetFieldOnArgument(
|
||||||
|
@ -788,7 +768,10 @@ public class BytecodeProviderImpl implements BytecodeProvider {
|
||||||
Opcodes.INVOKESTATIC,
|
Opcodes.INVOKESTATIC,
|
||||||
Type.getInternalName( foreignPackageMember.getForeignPackageAccessor() ),
|
Type.getInternalName( foreignPackageMember.getForeignPackageAccessor() ),
|
||||||
"get_" + getterMember.getName(),
|
"get_" + getterMember.getName(),
|
||||||
Type.getMethodDescriptor( Type.getType( type ), Type.getType( clazz ) ),
|
Type.getMethodDescriptor(
|
||||||
|
Type.getType( type ),
|
||||||
|
Type.getType( underlyingMember.getDeclaringClass() )
|
||||||
|
),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -983,7 +966,11 @@ public class BytecodeProviderImpl implements BytecodeProvider {
|
||||||
Opcodes.INVOKESTATIC,
|
Opcodes.INVOKESTATIC,
|
||||||
Type.getInternalName( foreignPackageMember.getForeignPackageAccessor() ),
|
Type.getInternalName( foreignPackageMember.getForeignPackageAccessor() ),
|
||||||
"set_" + setterMember.getName(),
|
"set_" + setterMember.getName(),
|
||||||
Type.getMethodDescriptor( Type.getType( void.class ), Type.getType( clazz ), Type.getType( type ) ),
|
Type.getMethodDescriptor(
|
||||||
|
Type.getType( void.class ),
|
||||||
|
Type.getType( foreignPackageMember.getMember().getDeclaringClass() ),
|
||||||
|
Type.getType( type )
|
||||||
|
),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue