I've come up against an odd issue in Eclipse while using the Stanford CoreNLP API. I've written a custom implementation of the Annotator interface, which amongst other things specifies two methods with the type signature Set<Class<? extends CoreAnnotation>>.
I've implemented those methods, but Eclipse is showing an error telling me that the type signature is incorrect. Specifically, it reports, The return type is incompatible with Annotator.requires(). The recommended fix suggests changing the return type to exactly the same type I already have written, but still leaves the error:
As you can see, the supposed `incorrect' type is exactly the same as the type given in the interface.
The project compiles correctly using mvn compile, so this isn't an actual compiler problem. Has anyone seen this before, and can you advise as to how to make those errors go away?
Edit: added screenshot showing the error
Edit2: added details of the error message in Eclipse
Related
im working on a huge project which has a lot of old code.
I found manually found some random case classes which are not used in the project and asked myself how many of those exists.
But I found no method to found them via scalac compiler or via some Intellij magic.
This code often uses sometimes this companion structure
object MyCompanionClass{
final case class TEST(...)
...
}
Running unused declaration in intellj ofcourse delivers only findings in java..
Can anyone help?
regards
The run config option Make, no error check in IntelliJ IDEA does not skip Scala errors that result in ambiguous ClassDefNotFound errors upon running a project.
How do I skip error checking when compiling Scala files?
My end goal is for the program to fail at runtime when the classes with errors are accessed, not before runtime preventing the whole program from running.
As the name suggests, "Make, no error check" will just pretend compile errors don't matter. Then obviously you end up with an incomplete class path, not containing any classes that produce compiler errors. As a consequence, when you run that project, you should not be surprised to find class-not-found errors.
I don't know how this "feature" interacts with the incremental Scala compiler. I wouldn't expect "Make, no error check" to produce any useful results.
If you want to skip parts of your code that currently don't compile, a good solution is to use the ??? "hole" value, i.e. a placeholder of type Nothing that you can plug into any position where you would have incomplete code. E.g.
def myMethod: String = ??? // implement later
This allows these things to be compiled and will only produce runtime errors when hit during runtime.
I have a routes file like this:
GET /getOf/:city/:fi/:state/:zipCode cont.Offer.getOf(city:String, fi:String, state:String, zipCode:String)
In my scala class, my code is like this:
def getOf(city:String, fi:String,state:String,zipCode:String) = Action(parse.anyContent) {request =>
val offer = Offer(city,fi,state,zipCode);
Ok(Json.toJson(offerService.getOffer(offer)));
}
But when I run I get this compilation error:
too many arguments for method apply: (name: String, constraint: String)play.core.DynamicPart in object DynamicPart
But same code works fine if I have only one argument. I even not understanding what's the problem. Yes, I have created Eclipse project with play clean-all and others. But still same problem persists.
Can anyone please guide me on this? As I am very new to Play framework and scala.
i got the same problem when i walk through from the below url http://scala-ide.org/docs/tutorials/play/index.html but the issue resolved by calling clean and then compile from play console solved the issue.
Note* i initially had the site at different folder.
I got this error only in eclipse IDE and if i make any changes to the views it compiled atonce whereas for controllers it check only when "RELOAD" works...till then you may see the error at eclipse ide but app works fine.
I'm using the Eclipse debugger and can't inspect/watch field values or results of field.method() calls. I've encountered the problem in both Juno and now in Indigo. At first I could resolve the issue by wiping out my .metadata and rebuilding, but now the problem occurs even with a fresh build.
A specific error: I create a Deflater object deflater = new Deflater();,
set some input deflater.setInput(buffer, 0, bufferPosition);,
then try to inspect functionality by highlighting a section of code deflater.needsInput()
and doing a right-click->Inspect. The error reads: "Cannot find the field deflater for the object apps.TestCore$Tests (id=27)".
The error only occurs when the field belongs to an inner class (In this case "Tests"); when the variable is local or the class is not an inner class, everything seems to be working. Hovering over the variable "deflater" shows the contents drill-down just like it should. Highlighting "deflater" and doing an Inspect gives the error, and using the Expressions view to inspect the variable/call methods on the variable gives the same error.
Please help; this is making my debugging life very difficult, as I have to use println() for anything more complex than a hover inspection can provide.
This is not remote debugging - just local to my system.
I have no errors show up in either the compilation or the hosted mode process, but the JS that GWT creates contain errors that disallow the proper rendering of the website. How can this happen? Is this a problem with the compiler?
FireBug is giving me nothing, no errors at all.
But I don't know where to go from here or what more information to give you all, since I can't effectively debug JS like this. More fundamentally, I just don't understand why GWT is giving me JS that doesn't work.
EDIT: I didn't really know what Pretty and Detailed meant until now. Thanks for pointing me to this. What I get now is http://i.imgur.com/qUyNb.png.
I'm not sure where to go from here.
EDIT 2: Here is the final image I will post (I promise!): http://i.imgur.com/ZVQVW.png. This is the pretty output. The error reads: "Uncaught com.google.gwt.core.client.JavaScriptException (TypeError): Cannot call method 'isString' of null (anonymous function)."
The resolution to this issue was the realization that isString was not a JNSI method, but instead a method I wrote in a try / catch block. This was the code that tripped me up:
try{something that will create a NullPointerException}
catch(NullPointerException npe){npe.printStackTrace()}
#Luismahou's link above said the following about error-catching in GWT:
Exceptions: try, catch, finally and user-defined exceptions are supported as normal, although Throwable.getStackTrace() is not meaningfully supported in production mode.
Note: Several fundamental exceptions implicitly produced by the Java VM, most notably NullPointerException, StackOverflowError, and OutOfMemoryError, do not occur in production mode as such. Instead, a JavaScriptException is produced for any implicitly generated exceptions. This is because the nature of the underlying JavaScript exception cannot be reliably mapped onto the appropriate Java exception type.
I think what happened is that my try block threw a NullPointerException, which was represented as a JavaScriptException and was uncaught by the catch block. Lesson learned: don't catch NullPointerExceptions, StackOverflowErrors, and OutOfMemoryErrors in GWT.