Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Invalid class package with noclasspath option #329

Closed
tdurieux opened this issue Sep 7, 2015 · 2 comments
Closed

Invalid class package with noclasspath option #329

tdurieux opened this issue Sep 7, 2015 · 2 comments

Comments

@tdurieux
Copy link
Collaborator

tdurieux commented Sep 7, 2015

Hi,

When I spoon a class (see example below) which contains external classes (imported but not in the classpath) with the noclasspath option, the packages of the external classes are not correct. Indeed the packages of the external classes are the local package (here myPackage) and not the package declared in the imports (here externalPackage).

Original file:

package myPackage;

import externalPackage.ExternalClass;

public class NoClassPathTestV0 {
    public void test() {
        assertEquals(ExternalClass.class, null);
    }
}

Spoon output:

package myPackage;

public class NoClassPathTestV0 {
    public void test() {
        assertEquals(myPackage.ExternalClass.class, null);
    }
}
@tdurieux
Copy link
Collaborator Author

This issue is already fixed with Spoon 4.3.
But further investigation is required to check if this Spoon 4.3 feature works with static imports.

@tdurieux
Copy link
Collaborator Author

As expected the static imports are not supported by Spoon.

Original class with static import:

package myPackage;

import static pack1.A.staticMethod;

public class AutoImportTestV0 {
    public void test() {
        String results = staticMethod("test", "test");
    }
}

Output of Spoon AutoImport

package myPackage;


public class AutoImportTestV0 {
    public void test() {
        String results = staticMethod("test", "test");
    }
}

Output of Spoon NoAutoImport

package myPackage;


public class AutoImportTestV0 {
    public void test() {
        java.lang.String results = staticMethod("test", "test");
    }
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant