IDEA-126885 Decompiler exception on jdk.nashorn.internal.objects.Global
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2014 JetBrains s.r.o.
|
* Copyright 2000-2015 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -19,6 +19,7 @@ import org.jetbrains.java.decompiler.code.CodeConstants;
|
|||||||
import org.jetbrains.java.decompiler.code.Instruction;
|
import org.jetbrains.java.decompiler.code.Instruction;
|
||||||
import org.jetbrains.java.decompiler.struct.consts.ConstantPool;
|
import org.jetbrains.java.decompiler.struct.consts.ConstantPool;
|
||||||
import org.jetbrains.java.decompiler.struct.consts.LinkConstant;
|
import org.jetbrains.java.decompiler.struct.consts.LinkConstant;
|
||||||
|
import org.jetbrains.java.decompiler.struct.consts.PooledConstant;
|
||||||
import org.jetbrains.java.decompiler.struct.consts.PrimitiveConstant;
|
import org.jetbrains.java.decompiler.struct.consts.PrimitiveConstant;
|
||||||
import org.jetbrains.java.decompiler.struct.gen.DataPoint;
|
import org.jetbrains.java.decompiler.struct.gen.DataPoint;
|
||||||
import org.jetbrains.java.decompiler.struct.gen.MethodDescriptor;
|
import org.jetbrains.java.decompiler.struct.gen.MethodDescriptor;
|
||||||
@@ -394,8 +395,8 @@ public class InstructionImpact {
|
|||||||
case CodeConstants.opc_ldc:
|
case CodeConstants.opc_ldc:
|
||||||
case CodeConstants.opc_ldc_w:
|
case CodeConstants.opc_ldc_w:
|
||||||
case CodeConstants.opc_ldc2_w:
|
case CodeConstants.opc_ldc2_w:
|
||||||
cn = pool.getPrimitiveConstant(instr.getOperand(0));
|
PooledConstant constant = pool.getConstant(instr.getOperand(0));
|
||||||
switch (cn.type) {
|
switch (constant.type) {
|
||||||
case CodeConstants.CONSTANT_Integer:
|
case CodeConstants.CONSTANT_Integer:
|
||||||
stack.push(new VarType(CodeConstants.TYPE_INT));
|
stack.push(new VarType(CodeConstants.TYPE_INT));
|
||||||
break;
|
break;
|
||||||
@@ -416,6 +417,9 @@ public class InstructionImpact {
|
|||||||
case CodeConstants.CONSTANT_Class:
|
case CodeConstants.CONSTANT_Class:
|
||||||
stack.push(new VarType(CodeConstants.TYPE_OBJECT, 0, "java/lang/Class"));
|
stack.push(new VarType(CodeConstants.TYPE_OBJECT, 0, "java/lang/Class"));
|
||||||
break;
|
break;
|
||||||
|
case CodeConstants.CONSTANT_MethodHandle:
|
||||||
|
stack.push(new VarType(((LinkConstant)constant).descriptor));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CodeConstants.opc_aload:
|
case CodeConstants.opc_aload:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2014 JetBrains s.r.o.
|
* Copyright 2000-2015 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -362,8 +362,14 @@ public class ExprProcessor implements CodeConstants {
|
|||||||
case opc_ldc:
|
case opc_ldc:
|
||||||
case opc_ldc_w:
|
case opc_ldc_w:
|
||||||
case opc_ldc2_w:
|
case opc_ldc2_w:
|
||||||
PrimitiveConstant cn = pool.getPrimitiveConstant(instr.getOperand(0));
|
PooledConstant cn = pool.getConstant(instr.getOperand(0));
|
||||||
pushEx(stack, exprlist, new ConstExprent(consts[cn.type - CONSTANT_Integer], cn.value, bytecode_offsets));
|
if (cn instanceof PrimitiveConstant) {
|
||||||
|
pushEx(stack, exprlist, new ConstExprent(consts[cn.type - CONSTANT_Integer], ((PrimitiveConstant)cn).value, bytecode_offsets));
|
||||||
|
}
|
||||||
|
else if (cn instanceof LinkConstant) {
|
||||||
|
//TODO: for now treat Links as Strings
|
||||||
|
pushEx(stack, exprlist, new ConstExprent(VarType.VARTYPE_STRING, ((LinkConstant)cn).elementname , bytecode_offsets));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case opc_iload:
|
case opc_iload:
|
||||||
case opc_lload:
|
case opc_lload:
|
||||||
|
|||||||
Reference in New Issue
Block a user