mirror of https://github.com/apache/openjpa.git
OPENJPA-293. Fixed bug with property access and booleans and 'is' accessors.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@567911 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3d22005bad
commit
7977291bea
|
@ -657,13 +657,6 @@ public class PCEnhancer {
|
|||
return "set" + StringUtils.capitalize(fmd.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the getter method for the given field.
|
||||
*/
|
||||
private static String getGetterName(FieldMetaData fmd) {
|
||||
return "get" + StringUtils.capitalize(fmd.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the field returned by the given method, or null if none.
|
||||
* Package-protected and static for testing.
|
||||
|
@ -3325,8 +3318,12 @@ public class PCEnhancer {
|
|||
}
|
||||
|
||||
private boolean setVisibilityToSuperMethod(BCMethod method) {
|
||||
BCMethod superMeth = _managedType.getMethods(method.getName(),
|
||||
method.getParamTypes())[0];
|
||||
BCMethod[] methods = _managedType.getMethods(method.getName(),
|
||||
method.getParamTypes());
|
||||
if (methods.length == 0)
|
||||
throw new UserException(_loc.get("no-accessor",
|
||||
_managedType.getName(), method.getName()));
|
||||
BCMethod superMeth = methods[0];
|
||||
if (superMeth.isPrivate()) {
|
||||
method.makePrivate();
|
||||
return true;
|
||||
|
@ -3348,7 +3345,9 @@ public class PCEnhancer {
|
|||
* performs any necessary field tracking.
|
||||
*/
|
||||
private void addSubclassGetMethod(FieldMetaData fmd) {
|
||||
String methName = getGetterName(fmd);
|
||||
String methName = "get" + StringUtils.capitalize(fmd.getName());
|
||||
if (_managedType.getMethods(methName, new Class[0]).length == 0)
|
||||
methName = "is" + StringUtils.capitalize(fmd.getName());
|
||||
BCMethod getter = _pc.declareMethod(methName, fmd.getDeclaredType(),
|
||||
null);
|
||||
setVisibilityToSuperMethod(getter);
|
||||
|
|
|
@ -194,3 +194,4 @@ subclasser-fetch-group-override: The field {1} in type {0} is configured to be \
|
|||
lazily loaded, but lazy loading is not available for classes that use field\
|
||||
access when not running the OpenJPA enhancer or when dynamic class \
|
||||
redefinition is not available.
|
||||
no-accessor: Could not find method called {0} in type {1}.
|
Loading…
Reference in New Issue