mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
JPS mappings for incremental compilation refactoring: for overridden method analysis, search for non-abstract methods using exact match (with return type), like it is in bytecode
GitOrigin-RevId: f77752af33fab766b2863c408ea0cfdea96a21b5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
be7be5f683
commit
2c149d06ef
@@ -0,0 +1,14 @@
|
||||
Cleaning output files:
|
||||
out/production/ChangeToCovariantMethodInBase3/maketest/BaseImplementation.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/maketest/BaseImplementation.java
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/ChangeToCovariantMethodInBase3/maketest/IImpl.class
|
||||
out/production/ChangeToCovariantMethodInBase3/maketest/Mediator.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/maketest/IImpl.java
|
||||
src/maketest/Mediator.java
|
||||
End of files
|
||||
@@ -1,10 +0,0 @@
|
||||
<testData>
|
||||
<deleted_by_make>
|
||||
<file path="classes/maketest/BaseImplementation.class" />
|
||||
<file path="classes/maketest/Mediator.class" />
|
||||
</deleted_by_make>
|
||||
|
||||
<recompile>
|
||||
<file path="source/maketest/Mediator.java" />
|
||||
</recompile>
|
||||
</testData>
|
||||
@@ -0,0 +1,16 @@
|
||||
Cleaning output files:
|
||||
out/production/ChangeToCovariantMethodInBase4/maketest/BaseBaseImpl.class
|
||||
out/production/ChangeToCovariantMethodInBase4/maketest/BaseImplementation.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/maketest/BaseBaseImpl.java
|
||||
src/maketest/BaseImplementation.java
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/ChangeToCovariantMethodInBase4/maketest/IImpl.class
|
||||
out/production/ChangeToCovariantMethodInBase4/maketest/Mediator.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/maketest/IImpl.java
|
||||
src/maketest/Mediator.java
|
||||
End of files
|
||||
@@ -0,0 +1,7 @@
|
||||
package maketest;
|
||||
|
||||
public class BaseBaseImpl {
|
||||
public Data getData() {
|
||||
return new DataEx();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package maketest;
|
||||
|
||||
public class BaseBaseImpl {
|
||||
public DataEx getData() {
|
||||
return new DataEx();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package maketest;
|
||||
|
||||
public class BaseImplementation extends BaseBaseImpl {
|
||||
public Data getData() {
|
||||
return new DataEx();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package maketest;
|
||||
|
||||
public class BaseImplementation extends BaseBaseImpl {
|
||||
public DataEx getData() {
|
||||
return new DataEx();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package maketest;
|
||||
|
||||
public class Data {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package maketest;
|
||||
|
||||
public class DataEx extends Data {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package maketest;
|
||||
|
||||
public interface I {
|
||||
Data getData();
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package maketest;
|
||||
|
||||
public class IImpl extends Mediator {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package maketest;
|
||||
|
||||
public interface J extends I {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package maketest;
|
||||
|
||||
public class Mediator extends BaseImplementation implements J {
|
||||
}
|
||||
@@ -7,10 +7,8 @@ src/ppp/BaseA.java
|
||||
src/ppp/BaseB.java
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/AddOverridingMethodAndChangeReturnType/ppp/BaseB.class
|
||||
out/production/AddOverridingMethodAndChangeReturnType/ppp/Client.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/ppp/BaseB.java
|
||||
src/ppp/Client.java
|
||||
End of files
|
||||
@@ -8,9 +8,7 @@ src/ppp/Super.java
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/PushFieldDown/ppp/Main.class
|
||||
out/production/PushFieldDown/ppp/Sub.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/ppp/Main.java
|
||||
src/ppp/Sub.java
|
||||
End of files
|
||||
@@ -1266,7 +1266,7 @@ public final class Mappings {
|
||||
debug("Current method overrides the added method");
|
||||
|
||||
final Iterable<File> files = classToSourceFileGet(methodClass.name);
|
||||
if (files != null) {
|
||||
if (files != null && !containsAll(myCompiledFiles, files)) {
|
||||
ContainerUtil.addAll(myAffectedFiles, files);
|
||||
if (myDebugS.isDebugEnabled()) {
|
||||
for (File file : files) {
|
||||
@@ -1351,7 +1351,7 @@ public final class Mappings {
|
||||
|
||||
for (final Pair<MethodRepr, ClassRepr> p : overridingMethods) {
|
||||
final Iterable<File> fNames = classToSourceFileGet(p.second.name);
|
||||
if (fNames != null) {
|
||||
if (fNames != null && !containsAll(myCompiledFiles, fNames)) {
|
||||
ContainerUtil.addAll(myAffectedFiles, fNames);
|
||||
if (myDebugS.isDebugEnabled()) {
|
||||
for (File fName : fNames) {
|
||||
@@ -1380,7 +1380,7 @@ public final class Mappings {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cc.name == it.name) {
|
||||
if (cc.name == it.name || !pp.first.equals(removedMethod) /*need exact match*/) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ public final class JavaDifferentiateStrategy implements DifferentiateStrategy {
|
||||
for (JvmNodeReferenceID id : propagated) {
|
||||
for (JvmClass subClass : future.getNodes(id, JvmClass.class)) {
|
||||
Iterable<Pair<JvmClass, JvmMethod>> overriddenForSubclass = future.getOverriddenMethods(subClass, removedMethod::isSameByJavaRules);
|
||||
boolean allOverriddenAbstract = !Iterators.isEmpty(overriddenForSubclass) && Iterators.isEmpty(Iterators.filter(overriddenForSubclass, p -> !p.getSecond().isAbstract()));
|
||||
boolean allOverriddenAbstract = !Iterators.isEmpty(overriddenForSubclass) && Iterators.isEmpty(Iterators.filter(overriddenForSubclass, p -> removedMethod.isSame(p.getSecond()) && !p.getSecond().isAbstract()));
|
||||
if (allOverriddenAbstract || future.inheritsFromLibraryClass(subClass)) {
|
||||
debug("Removed method is not abstract & overrides some abstract method which is not then over-overridden in subclass " + subClass.getName());
|
||||
for (NodeSource source : context.getGraph().getSources(subClass.getReferenceID())) {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.ether;
|
||||
|
||||
public class GenericTest extends IncrementalTestCase {
|
||||
@@ -76,11 +62,17 @@ public class GenericTest extends IncrementalTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
/* Not working yet
|
||||
public void testChangeToCovariantMethodInBase3() throws Exception {
|
||||
public void testChangeToCovariantMethodInBase3() {
|
||||
// Strictly speaking, recompilation of "IImpl" is not necessary, since all needed bridge methods will be included by the compiler into its base "Mediator" class (see the test's classes).
|
||||
// However, at the moment when decision is made, both Mediator and IImpl do not have necessary bridge methods, so the corresponding rule affects both classes.
|
||||
// At the moment we assume that it is fine to recompile more classes rather than make the rule to be more complicated.
|
||||
doTest();
|
||||
}
|
||||
*/
|
||||
|
||||
public void testChangeToCovariantMethodInBase4() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testChangeVarargSignature() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user