mirror of
https://github.com/zaaarf/lillero-processor.git
synced 2024-11-14 05:19:20 +01:00
fix: do not override non-abstract stubs
This commit is contained in:
parent
8229a7b455
commit
4215780e0d
1 changed files with 5 additions and 4 deletions
|
@ -192,10 +192,11 @@ public class JavaPoetUtils {
|
||||||
public static HashSet<MethodSpec> generateDummies(Collection<ExecutableElement> dummies) {
|
public static HashSet<MethodSpec> generateDummies(Collection<ExecutableElement> dummies) {
|
||||||
HashSet<MethodSpec> specs = new HashSet<>();
|
HashSet<MethodSpec> specs = new HashSet<>();
|
||||||
for(ExecutableElement d : dummies)
|
for(ExecutableElement d : dummies)
|
||||||
specs.add(MethodSpec.overriding(d)
|
if(d.getModifiers().contains(Modifier.ABSTRACT))
|
||||||
.addStatement("throw new $T($S)", RuntimeException.class, "This is a stub and should not have been called")
|
specs.add(MethodSpec.overriding(d)
|
||||||
.build()
|
.addStatement("throw new $T($S)", RuntimeException.class, "This is a stub and should not have been called")
|
||||||
);
|
.build()
|
||||||
|
);
|
||||||
return specs;
|
return specs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue