projectlombok / lombok

Very spicy additions to the Java programming language.
https://projectlombok.org/
Other
12.89k stars 2.39k forks source link

@Getter(lazy=true) failed to find correct method to call #1288

Closed Hubbitus closed 7 years ago

Hubbitus commented 7 years ago
public class LookupSelectMBDriver implements Interceptor {

    private MapperBuilderAssistant createBuilderAssistant(){
        return new MapperBuilderAssistant(mybatisConfiguration, this.getClass().getCanonicalName() + "-dynamic");
    }

…
private MappedStatement transformMappedStatement(MappedStatement ms, MapperMethod.ParamMap parameters){
        ResultMapping innerLookupAutoMapping = builderAssistant.buildResultMapping(
            (Class<?>)(parameters).get("resType"), "usageType", null, (Class<?>)LuUsageType.class
            ,null, null,ms.getResultMaps().get(0).getId() + "-dynamic-association-usageType"
            ,null, "u_", null, new ArrayList<ResultFlag>()
            ,null, null, mybatisConfiguration.isLazyLoadingEnabled()
        );
}

Will fail with:

/home/pasha/Projects/RLH/portal.lookups/portal-api/core/src/main/java/ru/rlh/egais/portal/backend/dao/mybatis/LookupSelectMBDriver.java:141: error: cannot find symbol
        ResultMapping innerLookupAutoMapping = builderAssistant.buildResultMapping(
                                                               ^
  symbol:   method buildResultMapping(Class<CAP#1>,String,<null>,Class<CAP#2>,<null>,<null>,String,<null>,String,<null>,ArrayList<ResultFlag>,<null>,<null>,boolean)
  location: variable builderAssistant of type AtomicReference<Object>
  where CAP#1,CAP#2 are fresh type-variables:
    CAP#1 extends Object from capture of ?
    CAP#2 extends Object from capture of ?

MapperBuilderAssistant class from MyBatis

If I instantiate it manually in method like:

MapperBuilderAssistant builderAssistant = new MapperBuilderAssistant(mybatisConfiguration, this.getClass().getCanonicalName() + "-dynamic");

project compiled fine.

Hubbitus commented 7 years ago

Sorry, it seams should be called like getBuilderAssistant() as it is just generate getter. My mistake.