Error while trying to compile aspect in Intellij

Asked

Viewed 143 times

1

This is my first question on this site, I will try to be succinct. I’m working with aspect-oriented programming, already working using Eclipse. However, while trying to do the same using the Intellij IDEA, I came across the following error:

Information:19/03/18 19:04 - Compilation completed with 2 errors and 0 warnings in 12s 856ms Error:ajc: invalid source option, source is either '1.3' or '1.4': 1.9 Error:Internal error: bad args

This example was taken from this website , I did exactly as it is, except for step 18( instead of selecting the whole .jar downloaded, I selected only the aspectjrt.jar as described in this tutorial)

This is my machine configuration:

Linux renan-Inspiron-3437 4.13.0-36-generic #40-Ubuntu SMP Fri Feb 16 20:07:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux java version "9.0.4" Java(TM) SE Runtime Environment (build 9.0.4+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

This is the source code of the application I’m trying to run:

public aspect World {

    pointcut greeting() : execution (* Hello.sayHello(..));

    after() returning() : greeting() {
        System.out.println("World");
    }
}

public class Hello {

    public static void main(String[] args) {
        sayHello();
    }

    public static void sayHello() {
        System.out.print("Hello ");
    }
}

These are some screenshots of my IDE configuration: inserir a descrição da imagem aqui inserir a descrição da imagem aquiinserir a descrição da imagem aqui

You’ve given thanks to anyone who’s willing to help me.

  • The method sayHello() in class Hello does not receive parameters!! Because it is passing .. on the line execution (* Hello.sayHello(..)); ?

  • The syntax of pointcut greeting() in appearance World that is to say: select a method with signature sayHello in class Hello independent of the arguments that this method receives (therefore ..). After that, the Advice runs and I have the output: Hello World (In eclipse works).

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.