Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

problems in installing library, problems with Processor.java #3

Open
kunalkala opened this issue Sep 18, 2013 · 3 comments
Open

problems in installing library, problems with Processor.java #3

kunalkala opened this issue Sep 18, 2013 · 3 comments
Assignees

Comments

@kunalkala
Copy link

In Eclipse, when I import the RestDroid folder initially as an android application, then 2 errors are occuring in Processor.java

Error#1 in line 523:
Type mismatch: cannot convert from Persistable<capture#75-of ? extends Resource> to Persistable

Error#2 in line 625

Type mismatch: cannot convert from Parser<capture#97-of ? extends Resource> to Parser

I have not added any code from my side yet, but these errors do not seem to go

@ghost ghost assigned PCreations Sep 20, 2013
@PCreations
Copy link
Owner

Hi,

Try to import the project as a Library Project, not an android application. This should be solve your problems.

@kunalkala
Copy link
Author

Thanks for your reply. I didn't get any compiler error on my laptop but got the 2 errors I mentioned on my desktop compiler. I used the following workaround the 2 errors. Please tell if these workarounds are okay. If so, you can also update them in the source code.

I was getting compile time error in line 625 in Processor,java where mParserFactory.getParser(resource.getClass()) was causing problem. I realized that .getClass() returns Class<?>, whereas mParserFactory.getParser needs Class <T extend Resource) as parameter. So I made the following modification inside the parseToInputStream method using explicit type casting:

    protected <R extends Resource> InputStream parseToInputStream(R resource) throws ParsingException {
    Class<R> claz=(Class<R>)resource.getClass();
    Parser<R> p = mParserFactory.getParser(claz);
    return p.parseToInputStream(resource);
}

The error vanished. I hope that this will not cause any runtime error. Will it?

For the other error in line 523, I explicitly used Resource.class in the getResourcePersistable method:

protected Persistable<Resource> getResourcePersistable(Resource resource) {
    return mPersistableFactory.getPersistable(Resource.class);
}

Please tell if this would work and there would be no runtime errors

2 more errors I noticed in the OrmLiteJacksonExample.
In the "public class ORMLiteJacksonModuleExample extends Activity" class, in line 93 mRequest.getResourceRepresentationj() should be mRequest.getResource(). Also, in Foo webservice, for the getUser GET method, the expiration time is missing.

On running the ORMLitJacksonModuleExample, directly downloading from GitHub and only making the above 2 changes, when I run I get runtime error. Is there a working example anywhere?

Thanks in advance

@PCreations
Copy link
Owner

The first modification should be right (I guess) but the second is not. You certainly will have a dynamic cast exception at runtime. I suggest you to switch on develop branch and tell me if it solves the issue. It seems the master release is not stable (which is very bad...).

For ORMLiteJacksonModuleExample it's not up to date (few refactoring didn't passed into the master release as you mentionned it), but the module ORMLiteJacksonModule itself should be up to date. You can find complete guide on my website at : http://pcreations.fr/restdroid-guides

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

No branches or pull requests

2 participants