IDEA-137568 Signature change may not trigger re-compilation of dependencies; code review follow-up

This commit is contained in:
Eugene Zhuravlev
2015-04-02 14:06:57 +03:00
parent aab9647a98
commit 29c0dea65a
3 changed files with 20 additions and 39 deletions
@@ -569,24 +569,8 @@ class ClassfileAnalyzer {
// do not register access to own class members
final String memberName = handle.getName();
final String memberDescriptor = handle.getDesc();
if (isFieldAccessHandle(handle)) {
final int tag = handle.getTag();
int opCode;
if (tag == Opcodes.H_GETFIELD) {
opCode = Opcodes.GETFIELD;
}
else if (tag == Opcodes.H_GETSTATIC) {
opCode = Opcodes.GETSTATIC;
}
else if (tag == Opcodes.H_PUTFIELD) {
opCode = Opcodes.PUTFIELD;
}
else if (tag == Opcodes.H_PUTSTATIC) {
opCode = Opcodes.PUTSTATIC;
}
else {
opCode = Opcodes.H_GETFIELD;
}
final int opCode = getFieldAccessOpcode(handle);
if (opCode > 0) {
registerFieldUsage(opCode, memberOwner, memberName, memberDescriptor);
}
else {
@@ -637,9 +621,18 @@ class ClassfileAnalyzer {
};
}
private boolean isFieldAccessHandle(Handle handle) {
final int tag = handle.getTag();
return tag == Opcodes.H_GETFIELD || tag == Opcodes.H_GETSTATIC || tag == Opcodes.H_PUTFIELD || tag == Opcodes.H_PUTSTATIC;
/**
* @param handle
* @return corresponding field access opcode or -1 if the handle does not represent field access handle
*/
private int getFieldAccessOpcode(Handle handle) {
switch (handle.getTag()) {
case Opcodes.H_GETFIELD: return Opcodes.GETFIELD;
case Opcodes.H_GETSTATIC: return Opcodes.GETSTATIC;
case Opcodes.H_PUTFIELD: return Opcodes.PUTFIELD;
case Opcodes.H_PUTSTATIC: return Opcodes.PUTSTATIC;
default: return -1;
}
}
@Override
@@ -214,20 +214,6 @@ public abstract class IncrementalTestCase extends JpsBuildTestCase {
module.addSourceRoot(getUrl(testRootRelativePath), JavaSourceRootType.TEST_SOURCE);
}
protected static boolean isRunningOnAtLeastJava(int javaVersion) {
final String versionString = System.getProperty("java.version");
final String prefix = "1.";
final int startIndex = versionString.startsWith(prefix) ? prefix.length() : 0;
final int dotIndex = versionString.indexOf('.', startIndex);
try {
int version = Integer.parseInt(versionString.substring(startIndex, dotIndex > startIndex? dotIndex : versionString.length()));
return version >= javaVersion;
}
catch (NumberFormatException ignored) {
}
return false;
}
private static class StringProjectBuilderLogger extends ProjectBuilderLoggerBase {
private final String myRoot;
private StringBuilder myLog;
@@ -15,6 +15,8 @@
*/
package org.jetbrains.ether;
import com.intellij.openapi.util.SystemInfo;
/**
* @author: db
* Date: 05.10.11
@@ -33,7 +35,7 @@ public class MethodPropertyTest extends IncrementalTestCase {
}
public void testChangeMethodRefReturnType() throws Exception {
if (isRunningOnAtLeastJava(8)) {
if (SystemInfo.isJavaVersionAtLeast("1.8")) {
doTest();
}
else {
@@ -42,7 +44,7 @@ public class MethodPropertyTest extends IncrementalTestCase {
}
public void testChangeLambdaTargetReturnType() throws Exception {
if (isRunningOnAtLeastJava(8)) {
if (SystemInfo.isJavaVersionAtLeast("1.8")) {
doTest();
}
else {
@@ -51,7 +53,7 @@ public class MethodPropertyTest extends IncrementalTestCase {
}
public void testChangeSAMMethodSignature() throws Exception {
if (isRunningOnAtLeastJava(8)) {
if (SystemInfo.isJavaVersionAtLeast("1.8")) {
doTest();
}
else {
@@ -60,7 +62,7 @@ public class MethodPropertyTest extends IncrementalTestCase {
}
public void testChangeLambdaSAMMethodSignature() throws Exception {
if (isRunningOnAtLeastJava(8)) {
if (SystemInfo.isJavaVersionAtLeast("1.8")) {
doTest();
}
else {