Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] class location question

Hi Neo,
this is not aspectj related but java related. If you move a class from a
package to another (like from the "sensor" package to the default
package), you must change your imports in other classes accordingly,
otherwise they will still search the classes in the old package instead
of the new one. Remove those imports if they are in a class in the same
package, or at least remove the "sensor" part from them, since the
sensor package does not exist anymore.

Hope this helps,
Simone

Neo Anderson wrote:
> I follow the tutorial (http://www.ibm.com/developerworks/library/j-aopwork5/) to practise design pattern. Whilst coding adaptor patterns, I encounter a problem. It is related to the path location.
>
> The files sturcture in which code works fine looks as below:
> sensor/TemperatureSensor.java
> sensor/RadiationSensor.java
> Test.java (where calls sensor classes)
> adaptor/Adaptors.aj (adaptor pattern module)
> adaptor/StatusSensor.java (sensor interface)
>
> Everything resembles the tutorial and it works well. However, if I change the files structure to following:
> TemperatureSensor.java
> RadiationSensor.java
> Test.java (where calls sensor classes)
> adaptor/Adaptors.aj (adaptor pattern module)
> adaptor/StatusSensor.java (sensor interface)
>
> In this structure I move sensors classes to the default package (the same level as Test class)
>
> Then when invoking ajc compiler it echos
>
> [error] The import sensor cannot be resolved
> import sensor.TemperatureSensor;
>        ^^^^^
>  [error] The import sensor cannot be resolved
> import sensor.RadiationSensor;
>        ^^^^^
>  [error] TemperatureSensor cannot be resolved to a type
> public String TemperatureSensor.getStatus(){
>               ^^^^^^^^^^^^^^^
>  [error] RadiationSensor cannot be resolved to a type
> public String RadiationSensor.getStatus(){
>               ^^^^^^^^^^^^^
>  [error] The type TemperatureSensor must implement the inherited abstract method StatusSensor.getStatus()
> public class TemperatureSensor{
>              ^^^^^^^^^^^^^^^^
>  [error] The type RadiationSensor must implement the inherited abstract method StatusSensor.getStatus()
> public class RadiationSensor{
>              ^^^^^^^^^^^^^^
>
> What causes this error? or How should I compile the source in order to solve this error? 
>
> Thank you very much,
>
>
>       __________________________________________________________
> Sent from Yahoo! Mail.
> A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>   



Back to the top