What is the reason for these error messages? - java

I'm getting error messages for no reason in RAD 8:
And the error message is complaining about a totally different method in a totaly different project in a totally different package. Is my error reporting erroneous? How can I resolve this? Since JSP validation appears to be broken in RAD 8 I have turned off validation for fragments but I want to be able to find legitimate errors. How do I proceed?

I know this is late, but...
When the error indicators don't even align with the source, it seems like RAD/Eclipse is internally looking at an outdated version of the file. I usually can clear this up by closing and re-opening the file, re-validating the file, or running a Clean build.

It appears to be something new in WAS 8. The validation is broken and must be turned off in order for this to work. Found out while upgrading from 6.1->8.0.
Fragments? Scriptlets? You shouldn't have those in JSPs. That's 1998 vintage stuff. I'd recommend JSTL.

Related

NetBeans 15 / 16 Java Compiler Failure

The problem is already reported at NullPointerException in compiler, Java files with red error badges can't be run
but I need to ask it here as a question because the more than 6 weeks old bug record does not have any response, no workaround. I really need to know how to get this problem solved, a type of problem that I have not seen before to that extent. I have been using NetBeans with Java for decades. Any suggestions, including non-technical are highly appreciated. More specifically, I would like to know how I can help the NetBeans team to pinpoint the error in nb-javac. Such issues are normally resolved with finer logging levels that would identify at least some offending files being processed. A NullPointerException without context is very difficult to analyze.
In a Maven project, the bug is most likely caused by a missing package statement in package-info.java file in the main sources. This condition is not reported by javac, and it is not reported by nb-javac.
Instead, the error occurs away from the culprit, in test source files.
So the solution is to add a package statement to package-info.java

Building Named parameter support for Java

I was thinking of building a tool through which we can have Named Parameters in Java 8+. I am looking for approaches on how to move forward with this. Here's what I have thought of so far,
Writing a compiler plugin which rewrites the method arranging and matching the parameters. In case it is not able to do so, it will throw a well defined exception. Caveat is I would also need to write extensions for IDEs so it does not show as a compile error in IDE.
Writing a buildscript which does the same as above, but does it pre-compilation. We still have the same problem as above and on top, I would have to write for multiple build systems.
Use AOP and use #Named annotations to specify names. IntelliJ and Eclipse both support aop compilers so IDE support should not be an issue. However this adds an extra overhead of adding AOP framework as a dependency.
There might also be some way to leverage Kotlin over here, but I am still exploring that.Looking forward to some ideas that I am completely unaware of as well as feasibility of what I have suggested.
I am not sure if opening a JEP would help as a proposal in 2015 was shot down.
FYI, I am not looking for answers/comments like why not switch to Kotlin. The point of this question is to know how feasible it is to implement this in Java, without changing the JDK itself.

Eclipse errors on startup

Sorry if this question is kind of vague. Let me know if I can provide any additional relevant details.
Basically, every so often (at least once every few weeks), when I open my Eclipse workspace I am greeted with a large number of errors. It often says that almost every single one of my projects have errors even though they were working just the day before. I understand that something is getting messed up in the build-path because it gives me errors such as The type java.lang.Object cannot be resolved. However, I don't understand why restarting Eclipse would cause this build-path to get messed up. It also seems fairly common for me to get errors on imports for various Android classes even though I have included the Android SDK in the project.
I guess what I am asking is twofold:
1) Why is this happening and is there anything that I can do to stop this from happening?
2) When this does happen, is there an easy way that I can resolve it? I know that I can go into the Preferences for an individual project and add libraries to the build-path but I can't figure out how to easily do this for all of my projects at once, and I feel like I'm just trying things until they work, so it would be good to have a more defined procedure for dealing with these sorts of problems.
EDIT:
Does anyone have any ideas?
You might need a valid JRE or JDK defined in the Java Build Path of your project.

Java Spring -- identify syntax errors at compile-time (in Eclipse)

I am new to Spring and just now learning to use it in a piece of legacy code. If I use bad syntax (as in I mistype a bean name or I use the wrong syntax to construct things like enums) then the code will compile fine.
This makes sense, since they're just XML files loaded at run-time.
For me, this is a big issue because my service can take up to 5 minutes to run, even though it compiles instantly. And there is no need for this, because all of the syntax errors can be known before the service is run. I shouldn't need an exception to know about it.
In Eclipse, is there a plugin or feature I can use to have compilation fail if my Spring syntax is invalid?
Sure. Take a look at STS (Spring Tool Suite) - it is a n Eclipse special bundle for working with Spring. It has the context XML validation plugin and many other goodies.

Methods to see result fo a code change faster

This question came to me when developing using Eclipse.
I use JBoss Application Server and use hot code replacement. But this option requires that the 'build automatically' option to be enabled. This makes Eclipse build the workspace automatically (periodically or when a file is saved?) and for a large code base this takes too much time and processing which makes the machine freeze for a while. Also sometimes an error message is shown saying that hot code replacement failed.
The question that I have is: is there a better way to see the result of a code change?
Currently I have the following two suggestions:
Have unit tests - this will allow to run a single test and see the result of a code change. ( But for a JavaEE application that uses EJBs is it easy to setup unit tests?)
Use OSGi - which allows to add jars to the running system without bringing down the JVM.
Any ideas on above suggestions or any other suggestion or a framework that allows to do this is welcome.
Did you take a look at http://zeroturnaround.com/jrebel/?
I tell you how I work. I hope it is useful. First of all, I disable "Build Automatically". Maybe it is better if you do a simple ANT script to compile and see errors/exceptions. Also, I make jar file with the same script. Afterwards, I use OSGi to check the application. Yo do not need to stop server, only you need to change versions in deployed bundles. Intead of JBoss Server I use Equinox which includes Jetty Web Server.
May you have a nice day!
With JRebel, you wouldn't have to build your project (skip the build totally). Plus, only the changed resources will be reloaded so the update happens instantly. Plus, session is preserved so you do not have re-login to the application after the update was performed.
Even though the question I asked was quite specific to Java, I thought that mentioning using an interpreted programming language that avoids the compilation step is anther way of seeing result of a code change faster.

Categories