Package org.objectweb.asm.tree.analysis

Examples of org.objectweb.asm.tree.analysis.AnalyzerException


            else if (val instanceof Float)
               return new ConstantValue.FloatConstant(((Float)val).floatValue());
            else if (val instanceof Double)
               return new ConstantValue.DoubleConstant(((Double)val).doubleValue());
            else
               throw new AnalyzerException(insn, "Unhandled bytecode instruction");
         }
         case NEW:
         {
            assert(insn instanceof TypeInsnNode);
            TypeInsnNode typeInsn = (TypeInsnNode)insn;
            String className = typeInsn.desc;
            return new TypedValue.NewValue(className);
         }
         case BIPUSH:
         case SIPUSH:
         {
            assert(insn instanceof IntInsnNode);
            IntInsnNode intInsn = (IntInsnNode)insn;
            return new ConstantValue.IntegerConstant(intInsn.operand);
         }
         case JSR:
         case GETSTATIC:
         default:
            throw new AnalyzerException(insn, "Unhandled bytecode instruction");
      }
   }
View Full Code Here


         case ATHROW:
         case INSTANCEOF:
         case MONITORENTER:
         case MONITOREXIT:
         default:
            throw new AnalyzerException(insn, "Unhandled bytecode instruction");
      }
   }
View Full Code Here

         case FCMPG:
         case DCMPL:
         case DCMPG:
         case PUTFIELD:
         default:
            throw new AnalyzerException(insn, "Unhandled bytecode instruction");
      }
   }
View Full Code Here

         case AASTORE:
         case BASTORE:
         case CASTORE:
         case SASTORE:
         default:
            throw new AnalyzerException(insn, "Unhandled bytecode instruction");
      }
   }
View Full Code Here

            MethodSignature sig = new MethodSignature(methodInsn.owner, methodInsn.name, methodInsn.desc);
            if (isVirtualCall)
            {
               TypedValue base = (TypedValue)values.get(0);
               if (methodChecker != null && !methodChecker.isMethodSafe(sig, base, args))
                  throw new AnalyzerException(insn, "Unknown method " + sig + " encountered");
               MethodCallValue.VirtualMethodCallValue toReturn;
               toReturn = new MethodCallValue.VirtualMethodCallValue(methodInsn.owner, methodInsn.name, methodInsn.desc, args, base);
               if (toReturn.isConstructor() && linkedFrame != null)
                  linkedFrame.replaceValues(base, toReturn);
               return toReturn;
            }
            else
            {
               if (methodChecker != null && !methodChecker.isStaticMethodSafe(sig))
                  throw new AnalyzerException(insn, "Unknown method " + sig + " encountered");
               return new MethodCallValue.StaticMethodCallValue(methodInsn.owner, methodInsn.name, methodInsn.desc, args);
            }
         }
         case INVOKEDYNAMIC:
         {
            assert(insn instanceof InvokeDynamicInsnNode);
            InvokeDynamicInsnNode invokeInsn = (InvokeDynamicInsnNode)insn;
            if (!"java/lang/invoke/LambdaMetafactory".equals(invokeInsn.bsm.getOwner())
                  || !"altMetafactory".equals(invokeInsn.bsm.getName())
                  || !"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;".equals(invokeInsn.bsm.getDesc()))
               throw new AnalyzerException(insn, "Unknown invokedynamic " + invokeInsn.bsm + " encountered");
            // Return the Lambda creation result
            Handle lambdaMethod = (Handle)invokeInsn.bsmArgs[1];
            Type functionalInterface = Type.getReturnType(invokeInsn.desc);
            return new LambdaFactory(functionalInterface, lambdaMethod);
         }
         case MULTIANEWARRAY:
         default:
            throw new AnalyzerException(insn, "Unhandled bytecode instruction");
      }
   }
View Full Code Here

         case IFNONNULL:
         case IF_ACMPNE:
            op = TypedValue.ComparisonValue.ComparisonOp.ne;
            break;
         default:
            throw new AnalyzerException(insn, "Unhandled bytecode instruction");
      }
      TypedValue.ComparisonValue toReturn =
         new TypedValue.ComparisonValue(op, (TypedValue)value1, (TypedValue)value2);
     
      if (branchHandler != null)
View Full Code Here

            while (baseVal instanceof TypedValue.GetFieldValue)
               baseVal = ((TypedValue.GetFieldValue)baseVal).operand;
            if (baseVal instanceof  TypedValue.ThisValue)
               return createGetFieldTypedValue(insn, value);
         }
         throw new AnalyzerException(insn, "Unhandled field access");
      }
      else
         return super.unaryOperation(insn, value);
   }
View Full Code Here

            {
               // Try to choose the most specific method
               int newCount = countObjectParameters(m);
               int oldCount = countObjectParameters(matchingMethod);
               if (newCount == oldCount)
                  throw new AnalyzerException(null, "Multiple methods have the expected name for the lambda");
               if (newCount > oldCount) continue;
            }
            matchingMethod = m;
         }
         return matchingMethod;
View Full Code Here

      // Open up the corresponding class to analyze
      TransformationClassAnalyzer classAnalyzer =
            new TransformationClassAnalyzer(lambdaClass.getName(), alternateClassLoader);
      Method matchingMethod = lambdaAsClass.findLambdaMethod(lambdaClass);
      if (matchingMethod == null)
         throw new AnalyzerException(null, "Could not find a lambda method with the expected name in the class");
      PathAnalysisFactory pathAnalysisFactory = new PathAnalysisFactory(
            metamodel.getMethodChecker(isObjectEqualsSafe));
      MethodAnalysisResults analysis = classAnalyzer.analyzeLambdaMethod(matchingMethod.getName(), Type.getMethodDescriptor(matchingMethod), pathAnalysisFactory);
      PathAnalysisSimplifier.cleanAndSimplify(analysis, metamodel.getComparisonMethods(isObjectEqualsSafe));
      return analysis;
View Full Code Here

    @Override
    public BasicValue binaryOperation(AbstractInsnNode insn, BasicValue value1, BasicValue value2) throws AnalyzerException {
        if(insn.getOpcode() == Opcodes.AALOAD) {
            Type t1 = value1.getType();
            if(t1 == null || t1.getSort() != Type.ARRAY) {
                throw new AnalyzerException(insn, "AALOAD needs an array as first parameter");
            }
           
            Type resultType = Type.getType(t1.getDescriptor().substring(1));
            return new BasicValue(resultType);
        }
View Full Code Here

TOP

Related Classes of org.objectweb.asm.tree.analysis.AnalyzerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.