mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
make rules fix: method overriding is not applicable to constructors
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
Cleaning output files:
|
||||
out/production/AddParameterToConstructor/Derived.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/Derived.java
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/AddParameterToConstructor/Client.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/Client.java
|
||||
End of files
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
public class Base {
|
||||
public Base() {
|
||||
}
|
||||
public Base(int param) {
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class Client {
|
||||
public static void main(String[] args) {
|
||||
Derived der = new Derived();
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
public class Derived extends Base {
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
public class Derived extends Base {
|
||||
public Derived(int ppp) {
|
||||
}
|
||||
}
|
||||
@@ -351,6 +351,9 @@ public class Mappings {
|
||||
}
|
||||
|
||||
private void addOverridingMethods(final MethodRepr m, final ClassRepr fromClass, final MethodRepr.Predicate predicate, final Collection<Pair<MethodRepr, ClassRepr>> container) {
|
||||
if (m.name == myInitName) {
|
||||
return; // overriding is not defined for constructors
|
||||
}
|
||||
final TIntHashSet subClasses = myClassToSubclasses.get(fromClass.name);
|
||||
if (subClasses == null) {
|
||||
return;
|
||||
@@ -387,6 +390,9 @@ public class Mappings {
|
||||
}
|
||||
|
||||
private Collection<Pair<MethodRepr, ClassRepr>> findOverriddenMethods(final MethodRepr m, final ClassRepr c) {
|
||||
if (m.name == myInitName) {
|
||||
return Collections.emptySet(); // overriding is not defined for constructors
|
||||
}
|
||||
final Collection<Pair<MethodRepr, ClassRepr>> result = new HashSet<Pair<MethodRepr, ClassRepr>>();
|
||||
addOverridenMethods(c, MethodRepr.equalByJavaRules(m), result);
|
||||
return result;
|
||||
|
||||
@@ -116,6 +116,10 @@ public class MemberChangeTest extends IncrementalTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAddParameterToConstructor() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDeleteInner() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user