Examples of NewExpr


Examples of javassist.compiler.ast.NewExpr

/*      */     }
/*  375 */     if (((type1 == 307) && (dim1 == 0) && ("java/lang/String".equals(cname))) || ((this.exprType == 307) && (this.arrayDim == 0) && ("java/lang/String".equals(this.className))))
/*      */     {
/*  378 */       ASTList sbufClass = ASTList.make(new Symbol("java"), new Symbol("lang"), new Symbol("StringBuffer"));
/*      */
/*  380 */       ASTree e = new NewExpr(sbufClass, null);
/*  381 */       this.exprType = 307;
/*  382 */       this.arrayDim = 0;
/*  383 */       this.className = "java/lang/StringBuffer";
/*  384 */       return makeAppendCall(makeAppendCall(e, left), right);
/*      */     }
View Full Code Here

Examples of javassist.compiler.ast.NewExpr

/* 1267 */       this.lex.get();
/* 1268 */       ASTList size = parseArraySize(tbl);
/* 1269 */       if (this.lex.lookAhead() == 123) {
/* 1270 */         init = parseArrayInitializer(tbl);
/*      */       }
/* 1272 */       return new NewExpr(t, size, init);
/*      */     }
/* 1274 */     if (t == 400) {
/* 1275 */       ASTList name = parseClassType(tbl);
/* 1276 */       t = this.lex.lookAhead();
/* 1277 */       if (t == 40) {
/* 1278 */         ASTList args = parseArgumentList(tbl);
/* 1279 */         return new NewExpr(name, args);
/*      */       }
/* 1281 */       if (t == 91) {
/* 1282 */         ASTList size = parseArraySize(tbl);
/* 1283 */         if (this.lex.lookAhead() == 123) {
/* 1284 */           init = parseArrayInitializer(tbl);
View Full Code Here

Examples of javassist.expr.NewExpr

          }
        }

        @Override
        public void edit(FieldAccess e) {
          NewExpr myLastNewExpr = lastNewExpr;
          lastNewExpr = null;
          if (myLastNewExpr != null && e.getFieldName().equals(field)) {
            newExprType.put(newPos, classSignatureToName(e.getSignature()));
          }
        }
View Full Code Here

Examples of soot.jimple.NewExpr

                }
            }
            if( s instanceof AssignStmt ) {
                Value rhs = ((AssignStmt)s).getRightOp();
                if( rhs instanceof NewExpr ) {
                    NewExpr r = (NewExpr) rhs;
                    SootClass cl = r.getBaseType().getSootClass();
                    for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
                        addEdge( source, s, clinit, Kind.CLINIT );
                    }
                } else if( rhs instanceof NewArrayExpr || rhs instanceof NewMultiArrayExpr ) {
                    Type t = rhs.getType();
View Full Code Here

Examples of soot.jimple.NewExpr

      } else {
        Body body = container.getActiveBody();
       
        //exc = new Error
        RefType runtimeExceptionType = RefType.v("java.lang.Error");
        NewExpr newExpr = Jimple.v().newNewExpr(runtimeExceptionType);
        LocalGenerator lg = new LocalGenerator(body);
        Local exceptionLocal = lg.generateLocal(runtimeExceptionType);
        AssignStmt assignStmt = Jimple.v().newAssignStmt(exceptionLocal, newExpr);
        body.getUnits().insertBefore(assignStmt, insertionPoint);
       
View Full Code Here

Examples of soot.jimple.NewExpr

          JimpleBody body = Jimple.v().newBody(m);
      m.setActiveBody(body);
     
      //exc = new Error
      RefType runtimeExceptionType = RefType.v("java.lang.Error");
      NewExpr newExpr = Jimple.v().newNewExpr(runtimeExceptionType);
      LocalGenerator lg = new LocalGenerator(body);
      Local exceptionLocal = lg.generateLocal(runtimeExceptionType);
      AssignStmt assignStmt = Jimple.v().newAssignStmt(exceptionLocal, newExpr);
      body.getUnits().add(assignStmt);
     
View Full Code Here

Examples of soot.jimple.NewExpr

                            //                             r.setMethod(changeClass.getMethod(
                            //                                     r.getMethod().getSubSignature()));
                        }
                    } else if (value instanceof NewExpr) {
                        // Fix up the object creations.
                        NewExpr r = (NewExpr) value;

                        if (!(unit instanceof AssignStmt)) {
                            continue;
                        }

                        AssignStmt stmt = (AssignStmt) unit;

                        try {
                            if (object != analysis.getObject((Local) stmt
                                    .getLeftOp())) {
                                continue;
                            }
                        } catch (Exception ex) {
                            if (_debug) {
                                System.out.println("Exception on new = " + ex);
                            }

                            continue;
                        }

                        if (r.getBaseType().getSootClass() == oldClass) {
                            r.setBaseType(RefType.v(newClass));

                            //   System.out.println("newValue = " +
                            //           box.getValue());
                            //                         } else if (r.getBaseType().getSootClass().getName().
                            //                                 startsWith(oldClass.getName())) {
View Full Code Here

Examples of soot.jimple.NewExpr

                                    methodRef.returnType(),
                                    methodRef.isStatic()));
                        }
                    } else if (value instanceof NewExpr) {
                        // Fix up the object creations.
                        NewExpr r = (NewExpr) value;

                        if (r.getBaseType().getSootClass() == oldClass) {
                            r.setBaseType(RefType.v(newClass));

                            //   System.out.println("newValue = " +
                            //           box.getValue());
                        } else if (r.getBaseType().getSootClass().getName()
                                .startsWith(oldClass.getName())) {
                            SootClass changeClass = _getInnerClassCopy(
                                    oldClass, r.getBaseType().getSootClass(),
                                    newClass);
                            r.setBaseType(RefType.v(changeClass));
                        }
                    }

                    //    System.out.println("value = " + value);
                    //   System.out.println("class = " +
View Full Code Here

Examples of soot.jimple.NewExpr

        // method.  Perhaps we can copy the method and inline the static
        // methods inside.  Even worse, what if we pass to an
        // object constructor?  We really need to create a static instance
        // of that class as well, and recurse.
        // First copy the class.
        NewExpr newExpr = (NewExpr) newStmt.getRightOp();
        SootClass instanceClass = newExpr.getBaseType().getSootClass();
        SootClass staticClass = copyClass(instanceClass, className);
        staticClass.setApplicationClass();

        // some reason when writing out BAF.
        // fold the class up to object.
View Full Code Here

Examples of soot.jimple.NewExpr

            } else if (rightOp instanceof Local) {
                Local local = (Local) rightOp;

                _updateTypeInAssignment(leftOp, in.get(local), out);
            } else if (rightOp instanceof NewExpr) {
                NewExpr newExpr = (NewExpr) rightOp;
                RefType type = newExpr.getBaseType();
                SootClass castClass = type.getSootClass();

                // If we are creating a Token type...
                if (SootUtilities.derivesFrom(castClass,
                        PtolemyUtilities.tokenClass)) {
                    // Then the rightOp of the expression is the type of the
                    // constructor.
                    _updateTypeInAssignment(leftOp, PtolemyUtilities
                            .getTokenTypeForSootType(type), out);
                } else {
                    // Otherwise there is nothing to be done.
                }
            } else if (rightOp instanceof NewArrayExpr) {
                // Since arrays are aliasable, we must update their types.
                NewArrayExpr newExpr = (NewArrayExpr) rightOp;
                Type type = newExpr.getBaseType();
                RefType tokenType = PtolemyUtilities.getBaseTokenType(type);

                if (tokenType != null) {
                    _updateTypeInAssignment(leftOp, PtolemyUtilities
                            .getTokenTypeForSootType(tokenType), out);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.