File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
querydsl-tooling/querydsl-apt/src/main/java/com/querydsl/apt Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,7 @@ private void handleConstructors(
206206 List <? extends Element > elements ,
207207 boolean onlyAnnotatedConstructors ,
208208 Messager messager ) {
209+ var builderNameSet = new HashSet <String >();
209210 for (ExecutableElement constructor : ElementFilter .constructorsIn (elements )) {
210211 if (configuration .isValidConstructor (constructor , onlyAnnotatedConstructors )) {
211212 var parameters = transformParams (constructor .getParameters ());
@@ -219,10 +220,20 @@ private void handleConstructors(
219220 constructor );
220221 return ;
221222 }
223+
222224 Constructor constructorModel = new Constructor (parameters );
223225 constructorModel .setUseBuilder (projection != null && projection .useBuilder ());
224226 constructorModel .setBuilderName (projection != null ? projection .builderName () : "" );
225227
228+ if (builderNameSet .contains (constructorModel .getBuilderName ())) {
229+ messager .printMessage (
230+ Diagnostic .Kind .ERROR ,
231+ "Duplicate builderName found: " + constructorModel .getBuilderName (),
232+ constructor );
233+ return ;
234+ }
235+
236+ builderNameSet .add (constructorModel .getBuilderName ());
226237 entityType .addConstructor (constructorModel );
227238 }
228239 }
You can’t perform that action at this time.
0 commit comments