IDEA-208443 Java decompiler not correctly decompiling string concatenation with recent Java

This commit is contained in:
Egor Ushakov
2019-03-06 14:22:46 +03:00
parent 1cdee1fbf4
commit a0a8f0a8dd
6 changed files with 71 additions and 27 deletions

View File

@@ -1,6 +1,4 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.java.decompiler.code;
@SuppressWarnings({"unused", "SpellCheckingInspection"})
@@ -9,12 +7,16 @@ public interface CodeConstants {
// BYTECODE VERSIONS
// ----------------------------------------------------------------------
int BYTECODE_JAVA_LE_4 = 1;
int BYTECODE_JAVA_5 = 2;
int BYTECODE_JAVA_6 = 3;
int BYTECODE_JAVA_7 = 4;
int BYTECODE_JAVA_8 = 5;
int BYTECODE_JAVA_9 = 6;
int BYTECODE_JAVA_LE_4 = 48;
int BYTECODE_JAVA_5 = 49;
int BYTECODE_JAVA_6 = 50;
int BYTECODE_JAVA_7 = 51;
int BYTECODE_JAVA_8 = 52;
int BYTECODE_JAVA_9 = 53;
int BYTECODE_JAVA_10 = 54;
int BYTECODE_JAVA_11 = 55;
int BYTECODE_JAVA_12 = 56;
int BYTECODE_JAVA_13 = 57;
// ----------------------------------------------------------------------
// VARIABLE TYPES

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.java.decompiler.struct;
import org.jetbrains.java.decompiler.code.CodeConstants;
@@ -157,28 +157,16 @@ public class StructClass extends StructMember {
}
public boolean isVersionGE_1_5() {
return (majorVersion > 48 || (majorVersion == 48 && minorVersion > 0)); // FIXME: check second condition
return (majorVersion > CodeConstants.BYTECODE_JAVA_LE_4 ||
(majorVersion == CodeConstants.BYTECODE_JAVA_LE_4 && minorVersion > 0)); // FIXME: check second condition
}
public boolean isVersionGE_1_7() {
return (majorVersion >= 51);
return (majorVersion >= CodeConstants.BYTECODE_JAVA_7);
}
public int getBytecodeVersion() {
switch (majorVersion) {
case 53:
return CodeConstants.BYTECODE_JAVA_9;
case 52:
return CodeConstants.BYTECODE_JAVA_8;
case 51:
return CodeConstants.BYTECODE_JAVA_7;
case 50:
return CodeConstants.BYTECODE_JAVA_6;
case 49:
return CodeConstants.BYTECODE_JAVA_5;
}
return CodeConstants.BYTECODE_JAVA_LE_4;
return majorVersion < CodeConstants.BYTECODE_JAVA_LE_4 ? CodeConstants.BYTECODE_JAVA_LE_4 : majorVersion;
}
@Override