get compilation errors on access to an instance on parent class

42 views
Skip to first unread message

Manav Brar

unread,
Jun 2, 2015, 6:26:25 PM6/2/15
to xtend...@googlegroups.com
Using Xtend output directory '/Users/mbrar/Documents/beaker/trulia-api/beaker-frontendNg/src/test/xtend'
[ERROR]
ERROR:     ExistingUserPDPLead.xtend -
60: The method getSauceAuth is undefined for the type ExistingUserPDPLead
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] trulia-api ......................................... SUCCESS [  0.193 s]
[INFO] api-spring ......................................... SUCCESS [  6.430 s]
[INFO] db-connect ......................................... SUCCESS [  0.365 s]
[INFO] api-test ........................................... SUCCESS [  0.459 s]
[INFO] beaker-auth ........................................ SUCCESS [  0.153 s]
[INFO] data-api ........................................... SUCCESS [  0.104 s]
[INFO] address-search ..................................... SUCCESS [  0.088 s]
[INFO] beaker-resource .................................... SUCCESS [  0.285 s]
[INFO] beaker-frontend .................................... SUCCESS [  0.187 s]
[INFO] frontend-api ....................................... SUCCESS [  0.841 s]
[INFO] beaker-frontendNg .................................. FAILURE [  5.242 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.481 s
[INFO] Finished at: 2015-06-02T15:23:18-07:00
[INFO] Final Memory: 59M/825M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.xtend:xtend-maven-plugin:2.8.3:testCompile (default) on project beaker-frontendNg: Error compiling xtend sources in '/Users/mbrar/Documents/beaker/trulia-api/beaker-frontendNg/src/test/java'. -> [Help 1]

Manav Brar

unread,
Jun 3, 2015, 12:14:41 AM6/3/15
to xtend...@googlegroups.com
the original code
val immutable = sauceAuth.createDriver(params)

produces generated code, which looks correct so what is the problem?
SauceCapabilitesAuth _sauceAuth = this.getSauceAuth();
final AbstractMobileSite immutable = _sauceAuth.createDriver(params);

Manav Brar

unread,
Jun 3, 2015, 12:39:28 AM6/3/15
to xtend...@googlegroups.com
packing I have hundreds of classes in my project using
import lombok.Getter;

one I removed that annotation the error went away, what about source level compatibility promise 😵. I have been using project lombok from 2012

Sven Efftinge

unread,
Jun 3, 2015, 2:00:19 AM6/3/15
to xtend...@googlegroups.com
Lombok is an annotation processor which are unfortunately not fully supported as of now.
In the case of Lombok it is even worth as it seem to require javac as the java compiler, since it down casts to internal non public types.

Here is a quote from one of the developers:
“””
It's a total hack. Using non-public API. Presumptuous casting (knowing that an
annotation processor running in javac will get an instance of JavacAnnotationProcessor,
which is the internal implementation of AnnotationProcessor (an interface), which
so happens to have a couple of extra methods that are used to get at the live AST).

On eclipse, it's arguably worse (and yet more robust) - a java agent is used to inject
code into the eclipse grammar and parser class, which is of course entirely non-public
API and totally off limits.
“”"

Xtend runs the eclipse compiler (not javac) over any java sources such that Xtend can link against the signatures.
So while Xtend will probably support Java annotation processing in the near future (for compatibility reasons, active annotations are much better ;-))
I am not sure that the ‘hacks' done in Lombok will be supported.

Btw. the quote concludes with
“””
If you could do what lombok does with standard API, I would have done it that way, but
you can't.
“”"
With Xtend you can do all of it and much more - without hacks! :-)

Cheers,
Sven

--
You received this message because you are subscribed to the Google Groups "Xtend Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xtend-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Manav Brar

unread,
Jun 3, 2015, 2:01:38 AM6/3/15
to xtend...@googlegroups.com
Can someone open a bug as this seems to be the case.

On further analysis things are not that bad, I see the lombok is working with model class, that would help me keep those hundreds on classes unchanged 👏☺︎
so this only happens in this special some of the code already listed, adding the additional code that seems to induce this.
import java.net.URL;

import lombok.Getter;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;

import com.trulia.api.frontend.api.webdriver.SauceCapabilitesAuth;
import com.trulia.api.frontend.api.webdriver.SelectorsInputs;

@Getter
@ContextConfiguration({ "classpath*:api-context.xml",
        "classpath*:frontend-context.xml" })
public class FrontEndMobileIT extends AbstractTestNGSpringContextTests {
    private static final URL LOCATION = Thread.currentThread()
            .getContextClassLoader().getResource("javascript/init.js");
    private final SauceCapabilitesAuth sauceAuth = SelectorsInputs.identity(
            SauceCapabilitesAuth.class, "sauceAuth");

    public static URL getLocation() {
        return LOCATION;
    }

}

removing unrelated code
public class SelectorsInputs {
   
    private SelectorsInputs() {
    }
   
    private static final class Holder {
         // some unrelated static final references removed
       
        private final static SauceCapabilitesAuth sauceAuth = new SauceAuth();
        private final static SauceREST sauceRest = new SauceREST(sauceAuth
                .getAuthentication().getUsername(), sauceAuth
                .getAuthentication().getAccessKey());

        public static <T> T castObject(final Class<T> type, final String bean) {
            final Map<String, Object> model = new IdentityHashMap<String, Object>();
            model.put("sauceRest", sauceRest);
            model.put("sauceAuth", sauceAuth);
            final SiteCapabilitiesAuth siteAuth = new SauceSiteAuth();
            model.put("siteAuth", siteAuth);
            final SiteWWW siteWWW = new SiteSauceCapabilities();
            model.put("siteWWW", siteWWW);
            final SiteBeaker siteBeaker = new SiteBeakerCapabilities();
            model.put("siteBeaker", siteBeaker);
            return type.cast(model.get(bean));
        }
    }
   
   // some unrelated code

    public static <T> T identity(final Class<T> type, final String bean) {
        return Holder.castObject(type, bean);

Sven Efftinge

unread,
Jun 3, 2015, 2:11:05 AM6/3/15
to xtend...@googlegroups.com
You can open bugs yourself : https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Xtend
Still I think it cannot work in general (see my previous post).

Manav Brar

unread,
Jun 3, 2015, 2:15:39 AM6/3/15
to xtend...@googlegroups.com, efft...@itemis.de
so I tried to use @Data form xtend lang but that did not give me the getter, when would you recommend I use on the listed code.

As long as I use lombok on classes that live on a different module then extend will see it as a regular java code, their is no way I am going to remove lombok from all of the code base.

Manav Brar

unread,
Jun 3, 2015, 2:37:08 AM6/3/15
to xtend...@googlegroups.com, efft...@itemis.de
had to convert the class in question to xtend for the @Accessors(PUBLIC_GETTER) annotation to work.
Reply all
Reply to author
Forward
0 new messages