Intellij editor does not resolve crypto package classes? - intellij-idea

Ver 14.1.1 Ultimate:
Can somebody please explain what is going on, what is the so special about crypto package mysterious behavior?
A. Mac class is unresolved according to editor.
B. SecretKeySpec is resolved only via .* notation and would give the same underscore red marking error if I would import individually the class.
C. I can run the method so it compiles?!

Glad I could help :)
IntelliJ has some hickups from time to time, in such cases I choose File -> Invalidate caches and restart. This is my first best shot at such kind of issues, and mostly the go away with that.

Related

When i click on the Kotlin Repl in IntelliJ Idea , the window never opens . Nothing happens . Please anyone tell me how to fix this

Kotlin Repl does not open ,nothing happens on clicking it
My solution/workaround. What happens is, and by the way the Intellij ide warns you about this, that you create the project and when naming it you use a space or similar unsupported character and the ide still seems to create the project just fine but actually it doesn't. Your project comes out misconfigured and you can't use Kotlin Repl. The simplest solution is to replace any spaces (or similar forbidden characters) with a hyphen "-" or an underscore "_" or simply use cammelCase. Best of luck to everybody and hope future learners of kotlin see this and spend less time troubleshooting such a simple issue.
Do you have a project open when you click it? This post states: "At this time the Kotlin REPL requires you to have a project open. You don't need to configure anything specific in the project; a Java project with the default settings will run just fine.
If you want to try Kotlin without configuring anything, you can use the online IDE at http://try.kotlinlang.org/"

IntelliJ IDEA doesn't give hint about package to be imported

Coming from Eclipse world, I really miss this important feature where Eclipse suggests if particular package needs to be imported for compilation error
e.g.
new ArrayList , this simply says Can't resolve symbol
'ArrayList' but doesn't suggest which package to import like eclipse
does.
Is this bug with IDEA or some setting needs to be done in it ?
[Solution]
The problem turns out be bad UX from IDEA
If user does mouse over, it show error message as per above screen shot
If user puts mouse somewhere else; it suggests package to import sometimes. It's not as friendly as Eclipse though
I've posted answer in bottom part of question. IDEA has got confusing & not so user friendly UX which gives hints about package to import.
I find it more useful in Eclipse, hope IDEA team will fix this
https://www.jetbrains.com/help/idea/auto-import.html

Intellij Idea's console increase max symbols per line

Intellij idea wraps console output in the run window, how I can increase N after which wrap happens?
as you can see wrap happened on the last line, how I can configure IDE not to wrap so short lines? I have a lot of free space in this window
P.S. windows, golang plugin for Intellij idea
Thanks!
there's already a ticket for this on the issue tracker of the plugin, please see this issue. However, it's dependent on a platform issue, please see this issue. My advice would be to track either of the issue in order to know when this is fixed, unfortunately it's not much that the plugin can do right now as far as I can tell.

"Guess" method arguments in IntelliJ IDEA

Eclipse has a feature, where it "guesses" arguments for a method call, based on types (and probably variable names?). Is there an equivalent in IntelliJ? I know Smart Complete should be capable of completing multiple arguments, but it doesn't work as good (especially when there is more than one String argument for example).
EDIT: It's called "Insered best guessed arguments" in Eclipse.
There is Ctrl+Shift+Space (Smart-Type, I think), but as of this writing, it's crap and doesn't go the whole hog.
Despite being an Eclipse fan, I've always openly acknowledge that if Eclipse can do it, IntelliJ can probably do it better... not this time, how dissappointing q(`_`!)p
IDEA doesn't support it, see the related feature request.
Try
(Ctrl+P) for Windows/Linux
Or
(Cmd+P) for OS X
this lists you the parameters for a method.
If you can accept a very basic low tech version of this, you could try this Gist
https://gist.github.com/kontext-e/f68c6a1b90dd862afb5d
for IDEAs LivePlugin.
Please ping me if there is some interest that I should make a real plugin out of this.

Why's a simple change to rt.jar causing the Java Runtime Environment to crash silently?

This is what I'm doing:
extract contents of my JRE's rt.jar
extract src.zip of my JDK (same version)
Now, if I copy Runtime.java from the extracted src folder and compile it using javac.exe without any modifications and then put it in the extracted rt folder to finally put everything back in a jar file using jar.exe, everything works as expected. The JRE runs fine.
However, if I make the slightest change to Runtime.java and compile it and put it in rt.jar, the JRE crashes whenever I attempt to start it. This is an example of a slight change that causes the silent crash:
/** Don't let anyone else instantiate this class */
private Runtime() {
System.out.println("This is a test.");
}
Instead of:
/** Don't let anyone else instantiate this class */
private Runtime() {}
Could anyone tell me why this is causing my JRE to crash?
Thanks in advance.
It's possible that System.out has not been initialised at the time that the Runtime() constructor runs. Usually console output is not considered a "slight" change, but at the wrong time it can invoke way too much stuff that may not be set up at all yet.
You're doing this all wrong. You can't distribute that modified JRE for a start, so it is only useful inside your organization . Install a SecurityManager and don't grant your codebase any of the RuntimePermissions you're trying to protect against.
#Tom - I advise you NOT to try to do this:
You cannot distribute the modified rt.jar file without violating the Sun binary license.
Even if you did, you would not be allowed to call it Java.
As you are finding, there are lots of complications that arise when you make changes, particularly when those changes might interfere with the JVM's behind the scenes initialization. And when things blow up during initialization, the JVM often cannot report the problem in an intelligible way.
If you do succeed in making the modified rt.jar work for one JRE, there is no guarantee that the same hacks will work for a different version.
Nobody in their right mind would knowingly use a modified JVM (especially one modified by a third-party) in a production app.
EDIT : judging from your other questions, I guess you are trying to reverse engineer or modify some third party Java application with a custom launcher. If you provided more information on what you were really trying to do, we might be able to suggest the right way to do it ... rather than using "desperate measures" such as modifying the JRE.
That's pretty strange, as I did the same trick with many classes in rt.jar in past.
Can you provide us with the crashed process output?