Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
034cdf2e0b | ||
|
|
95ee84cb99 | ||
|
|
3fc098b155 |
No files matched your search
@@ -0,0 +1,7 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
public interface Bug411 {
|
||||
default f() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import de.dhbwstuttgart.typeinference.constraints.Pair;
|
||||
import de.dhbwstuttgart.typeinference.unify.PlaceholderRegistry;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.*;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -54,7 +55,8 @@ public class FCGenerator {
|
||||
|
||||
|
||||
private static Boolean isFunctionalInterface(ClassOrInterface cly) {
|
||||
return (cly.isInterface() && (cly.isFunctionalInterface() || cly.getMethods().size() == 1));
|
||||
// TODO isFunctionalInterface should be set properly, we shouldn't need to check it again
|
||||
return (cly.isInterface() && (cly.isFunctionalInterface() || cly.getMethods().size() == 1 && Modifier.isAbstract(cly.getMethods().getFirst().modifier)));
|
||||
}
|
||||
|
||||
private static Pair genImplFunType(ClassOrInterface cly, RefTypeOrTPHOrWildcardOrGeneric fIType, HashMap<String, RefTypeOrTPHOrWildcardOrGeneric> gtvs) {
|
||||
|
||||
@@ -409,8 +409,9 @@ public class SyntaxTreeGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
boolean isFunctonalInterfce = methods.size() == 1 && Modifier.isAbstract(methods.getFirst().modifier);
|
||||
var staticCtor = Optional.of(this.generateStaticConstructor(ctx.identifier().getText(), staticFieldInitializations, genericParams, ctx.getStart()));
|
||||
return new ClassOrInterface(modifiers, name, fields, Optional.empty(), staticCtor, methods, new ArrayList<>(), genericParams, superClass, true, methods.size() == 1 ? true : false, extendedInterfaces, permittedSubtypes, ctx.getStart(), fileName);
|
||||
return new ClassOrInterface(modifiers, name, fields, Optional.empty(), staticCtor, methods, new ArrayList<>(), genericParams, superClass, true, isFunctonalInterfce, extendedInterfaces, permittedSubtypes, ctx.getStart(), fileName);
|
||||
}
|
||||
|
||||
private GenericDeclarationList createEmptyGenericDeclarationList(Token classNameIdentifier) {
|
||||
|
||||
@@ -1760,6 +1760,12 @@ public class TestComplete {
|
||||
assertEquals("many", name.invoke(instance, 2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBug411() throws Exception {
|
||||
var classFiles = generateClassFiles(createClassLoader(), "Bug411.jav");
|
||||
var clazz = classFiles.get("Bug411");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBug412() throws Exception {
|
||||
var classFiles = generateClassFiles(createClassLoader(), "Bug412.jav");
|
||||
|
||||
Reference in new issue
Block a user