Package org.aspectj.org.eclipse.jdt.internal.compiler.codegen

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Label


   
    if (initFailureField != null) {
      // Changes to this exception handling code may require changes to
      // BcelClassWeaver.isInitFailureHandler()
      handlerLabel.placeEnd();
      Label endLabel = new Label(codeStream);
      codeStream.goto_(endLabel);
      handlerLabel.place();
      codeStream.astore_0(); // Bug #52394
        codeStream.aload_0();
      codeStream.putstatic(initFailureField);
      endLabel.place();
    }
   
  }
View Full Code Here


  private void generatePerTypeWithinAspectOfMethod(ClassFile classFile) {
      final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
      generateMethod(classFile, aspectOfMethod, new BodyGenerator() {
        public void generate(CodeStream codeStream) {
         
          Label instanceFound = new Label(codeStream);

          ExceptionLabel anythingGoesWrong = new ExceptionLabel(codeStream,world.makeTypeBinding(UnresolvedType.JAVA_LANG_EXCEPTION));
          codeStream.aload_0()
          codeStream.invokestatic(world.makeMethodBindingForCall(AjcMemberMaker.perTypeWithinGetInstance(typeX)));
          codeStream.astore_1();
          codeStream.aload_1();
          codeStream.ifnonnull(instanceFound);
          codeStream.new_(world.makeTypeBinding(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION));
          codeStream.dup();
         
          codeStream.ldc(typeX.getName());
          codeStream.aconst_null();
         
          codeStream.invokespecial(world.makeMethodBindingForCall(AjcMemberMaker.noAspectBoundExceptionInit2()));
          codeStream.athrow();
          instanceFound.place();
            codeStream.aload_1();
         
          codeStream.areturn();
          anythingGoesWrong.placeEnd();
          anythingGoesWrong.place();
View Full Code Here

  {
    final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
    generateMethod(classFile, aspectOfMethod, new BodyGenerator() {
      public void generate(CodeStream codeStream) {
        // body starts here       
        Label wrongType = new Label(codeStream);
        Label popWrongType = new Label(codeStream);
        codeStream.aload_0();
        codeStream.instance_of(interfaceType);
        codeStream.ifeq(wrongType);
        codeStream.aload_0();
        codeStream.checkcast(interfaceType);
        codeStream.invokeinterface(world.makeMethodBindingForCall(
          AjcMemberMaker.perObjectInterfaceGet(typeX)));
         
        codeStream.dup();
        codeStream.ifnull(popWrongType);
        codeStream.areturn();
       
        popWrongType.place();
        codeStream.pop();
       
        wrongType.place();
        codeStream.new_(world.makeTypeBinding(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION));
        codeStream.dup();
View Full Code Here

    final TypeBinding interfaceType) {
    final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
    generateMethod(classFile, hasAspectMethod, new BodyGenerator() {
      public void generate(CodeStream codeStream) {
        // body starts here
        Label wrongType = new Label(codeStream);
        codeStream.aload_0();
        codeStream.instance_of(interfaceType);
        codeStream.ifeq(wrongType);
        codeStream.aload_0();
        codeStream.checkcast(interfaceType);
        codeStream.invokeinterface(world.makeMethodBindingForCall(
          AjcMemberMaker.perObjectInterfaceGet(typeX)));
        codeStream.ifnull(wrongType);
        codeStream.iconst_1();
        codeStream.ireturn();
       
        wrongType.place();
        codeStream.iconst_0();
        codeStream.ireturn();
        // body ends here
      }});
  }
View Full Code Here

  private void generatePerTypeWithinHasAspectMethod(ClassFile classFile) {
      final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
      generateMethod(classFile, hasAspectMethod, new BodyGenerator() {
        public void generate(CodeStream codeStream) {
             ExceptionLabel goneBang = new ExceptionLabel(codeStream,world.makeTypeBinding(UnresolvedType.JAVA_LANG_EXCEPTION));
             Label noInstanceExists = new Label(codeStream);
             Label leave = new Label(codeStream);
             goneBang.placeStart();
             codeStream.aload_0();
             codeStream.invokestatic(world.makeMethodBinding(AjcMemberMaker.perTypeWithinGetInstance(typeX)));
             codeStream.ifnull(noInstanceExists);
             codeStream.iconst_1();
             codeStream.goto_(leave);
             noInstanceExists.place();
             codeStream.iconst_0();
             leave.place();
             goneBang.placeEnd();
             codeStream.ireturn();
             goneBang.place();
             codeStream.astore_1();
             codeStream.iconst_0();
View Full Code Here

    final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
    generateMethod(classFile, AjcMemberMaker.perObjectBind(world.fromBinding(binding)),
    new BodyGenerator() {
      public void generate(CodeStream codeStream) {
        // body starts here
        Label wrongType = new Label(codeStream);
        codeStream.aload_0();
        codeStream.instance_of(interfaceType);
        codeStream.ifeq(wrongType)//XXX this case might call for screaming
        codeStream.aload_0();
        codeStream.checkcast(interfaceType);
        codeStream.invokeinterface(world.makeMethodBindingForCall(
          AjcMemberMaker.perObjectInterfaceGet(typeX)));
        //XXX should do a check for null here and throw a NoAspectBound
        codeStream.ifnonnull(wrongType);
       
        codeStream.aload_0();
        codeStream.checkcast(interfaceType);
        codeStream.new_(binding);
        codeStream.dup();
        codeStream.invokespecial(
          new MethodBinding(0, "<init>".toCharArray(),
            BaseTypes.VoidBinding, new TypeBinding[0],
            new ReferenceBinding[0], binding));
        codeStream.invokeinterface(world.makeMethodBindingForCall(
          AjcMemberMaker.perObjectInterfaceSet(typeX)));
       
        wrongType.place();
        codeStream.return_();
        // body ends here
      }});
  }
View Full Code Here

         *   return ajc$perSingletonInstance;
         */
                // body starts here (see end of each line for what it is doing!)
        FieldBinding fb = world.makeFieldBinding(AjcMemberMaker.perSingletonField(typeX));
        codeStream.getstatic(fb);                                                              // GETSTATIC
        Label isNonNull = new Label(codeStream);
        codeStream.ifnonnull(isNonNull);                                                       // IFNONNULL
        codeStream.new_(world.makeTypeBinding(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION));      // NEW
        codeStream.dup();                                                                      // DUP
        codeStream.ldc(typeX.getNameAsIdentifier());                                           // LDC
        codeStream.getstatic(initFailureField);                                                // GETSTATIC
        codeStream.invokespecial(world.makeMethodBindingForCall(
                  AjcMemberMaker.noAspectBoundExceptionInitWithCause()));            // INVOKESPECIAL
        codeStream.athrow();                                                                   // ATHROW
        isNonNull.place();
        codeStream.getstatic(fb);                                                              // GETSTATIC
        codeStream.areturn();                                                                  // ARETURN
        // body ends here
      }});
  }
View Full Code Here

    generateMethod(classFile, hasAspectMethod, new BodyGenerator() {
      public void generate(CodeStream codeStream) {
        // body starts here
        codeStream.getstatic(world.makeFieldBinding(AjcMemberMaker.perSingletonField(
            typeX)));
        Label isNull = new Label(codeStream);
        codeStream.ifnull(isNull);
        codeStream.iconst_1();
        codeStream.ireturn();
        isNull.place();
        codeStream.iconst_0();
        codeStream.ireturn();
        // body ends here
      }});
  }
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Label

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.