Tuesday, February 9, 2016

IntelliJ Tips



removing directory from project

You can manage your project contents via the .blazeproject file (Blaze > Project > Open Project View 

To remove a package, delete the relevant lines in the 'directories' and 'targets' sections, then re-run blaze sync.



https://stackoverflow.com/questions/21177495/renaming-a-project-in-intellij-idea
Renaming a project in IntelliJ IDEA

You can change the project name, which is the name that is shown in the recent projects list, like so:
Go to Project Structure (Ctrl+Alt+Shift+S) → Project Settings / Project → Project name:

Plugsin
Key Promoter X
https://plugins.jetbrains.com/plugin/9792-key-promoter-x

Awesome Console
Bamboo Soy

https://stackoverflow.com/questions/21177495/renaming-a-project-in-intellij-idea
You can change the project name, which is the name that is shown in the recent projects list, like so:
Go to Project Structure (Ctrl+Alt+Shift+S) → Project Settings / Project → Project name:

https://www.jetbrains.com/help/idea/pro-tips.html
Quick Documentation is your friend. Press Ctrl+Q

Code completion case sensitivity #
Settings/Preferences dialog (Ctrl+Alt+S), Editor | General | Code Completion
https://intellij-support.jetbrains.com/hc/en-us/community/posts/207028715-Show-error-warning-markers-next-to-line-number
1) Pay attention to overall file status -> top left corner
2) Use Navigate|Next/Prev error (F2) to quickly scan the file
3) Try to make it 'green' after you make it work as expected and keep it that way
4) Use Code|Analyse to review the current changelist/other scope

https://www.jetbrains.com/help/idea/creating-and-optimizing-imports.html
Automatically add import statements
  1. In the Settings/Preferences dialog (Ctrl+Alt+S), click Editor | General | Auto Import.
  2. Select the Add unambiguous imports on the fly checkbox, and apply the changes.

Install plugins
  1. Press Ctrl+Alt+S to open the Settings/Preferences dialog and then go toPlugins.
https://stackoverflow.com/questions/18814076/how-to-make-intellij-show-eclipse-like-api-documentation-on-mouse-hover/26915018
File | settings | editor | general | other | "Show quick doc on mouse move".

https://www.jetbrains.com/help/idea/using-live-templates.html
psfs

public static final String
psvm

public static void main(String[] args){ }
sout

System.out.println();

https://stackoverflow.com/questions/934794/is-there-break-on-exception-in-intellij/28480419
Run | View Breakpoints | Exception Breakpoints
https://stackoverflow.com/questions/26381013/introduce-parameter-object-refactoring-in-intellij-13
Place the cursor on the method and from the top menu choose Refactor -> Extract -> Parameter Object. In the dialog that's opened, choose the class' name, package etc. and press "Refactor".
https://stackoverflow.com/questions/7934876/intellij-idea-show-javadoc-automatically/28409582
  • When you write code:
    File -> Settings -> Editor -> General -> Code Completion -> Autopopup documentation in (ms)
It's only available when you press CTRL+SPACE It's more usable if you select the pin icon when it popups. The documentation window will be added to the tabs on the right. Later on I recommend to resize the window and to uncheck the Pinned property.
  • On mouse hover:
    File -> Settings -> Editor -> General -> Show quick documentation on mouse move
https://intellij-support.jetbrains.com/hc/en-us/community/posts/207028715-Show-error-warning-markers-next-to-line-number
1) Pay attention to overall file status -> top left corner
2) Use Navigate|Next/Prev error (F2) to quickly scan the file
3) Try to make it 'green' after you make it work as expected and keep it that way
4) Use Code|Analyse to review the current changelist/other scope

  • macOS: ~/Library/Preferences/IntelliJ IDEA<xx>/keymaps/
https://stackoverflow.com/questions/3348816/intellij-never-use-wildcard-imports
n IDEA 13 "Use single class import" does not prevent wildcard imports. The solution is to go to Preferences ( + , on macOS / Ctrl + Alt + S on Windows) > Editor > Code Style > Java > Imports tab set Class count to use import with '*' and Names count to use static import with '*' to a higher value.

https://stackoverflow.com/questions/1945213/what-is-eclipses-ctrlo-show-outline-shortcut-equivalent-in-intellij-idea
  • Mac: +F12
https://www.jetbrains.com/help/idea/navigating-to-class-file-or-symbol-by-name.html
On the main menu, point to Navigate, and then choose ClassFile, or Symbol respectively, or use the following shortcuts:
  • Class: ⌘O
  • File (directory): ⇧⌘O
  • Symbol: ⌥⌘O
https://stackoverflow.com/questions/43199785/jetbrains-products-not-showing-fn-keys-on-touchbar
If you are using ToolBox App to install your JetBrains products then please have a look at the comments in IDEA-167332 ticket -- you will have to locate your apps in ~/Library/Application Support/JetBrains/Toolbox/apps/ folder.
Downside -- you need to repeat this to every new build of such app that you will install as the path to actual app will be different every time.
go to: System preferences -> Keyboard -> Shortcuts -> Functions keys
Click the + icon
Then press CMD+SHIFT+G to open up a path window. Enter: ~/Library/Application Support/JetBrains/Toolbox/apps
https://docs.alfresco.com/5.2/tasks/sdk-debug-intellij.html
Open the IntelliJ IDEA IDE and click on Run Configurations (top right).


https://intellij-support.jetbrains.com/hc/en-us/community/posts/206912435-copy-fully-qualified-class-name
CtrlAltShift+C - copy reference
https://www.ysofters.com/2014/10/01/intellij-idea-zoom-text-by-mouse-wheel/
IntelliJ Idea has this feature, but it’s disabled by default.
You can enable zoom in few steps. Open Settings (Ctrl+Alt+S), search for “zoom“, select Editor.
https://stackoverflow.com/questions/1945213/what-is-eclipses-ctrlo-show-outline-shortcut-equivalent-in-intellij-idea
 I believe Ctrl + F12 may do what you want: it is the shortcut for the File structure Popup in the default 
cmd + f12 for OS X 
https://stackoverflow.com/questions/18814076/how-to-make-intellij-show-eclipse-like-api-documentation-on-mouse-hover

To show the documentation info with "Mac OS X 10.5+" keymap press CTRL + J (thanks @GreenTurtle for sharing this)
Settings -> Editor -> "Show quick doc on mouse move"
https://stackoverflow.com/questions/17571348/idea-equivalent-of-eclipse-type-hierarchy-f4
Is this the feature you are looking for? The shortcut is Ctrl+H

http://stackoverflow.com/questions/5905896/intellij-inspection-gives-cannot-resolve-symbol-but-still-compiles-code
First of all you should try File | Invalidate Caches and if it doesn't help, delete IDEA system directory. Then re-import the Maven project and see if it helps.
In some weird cases compiled classes may report wrong info and confuse IDEA. Verify that the classes from this jar report correct names using javap.
https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs
  • Configuration:
~/Library/Preferences/<PRODUCT><VERSION>
  • Caches:
~/Library/Caches/<PRODUCT><VERSION>
  • Plugins:
~/Library/Application Support/<PRODUCT><VERSION>
  • Logs:
~/Library/Logs/<PRODUCT><VERSION>

https://www.jetbrains.com/help/idea/2016.3/adding-an-existing-module-to-a-project.html
  1. Open the project you want to add a module to, and select File | New | Module from Existing Sources.
http://stackoverflow.com/questions/29166100/how-to-fully-clean-re-resolve-and-rebuild-a-scala-sbt-managed-project-in-idea
1) Close IntelliJ
2) delete .idea/libraries internals
3) Start IntelliJ
4) right-clicked pom.xml Maven > Reimport
After that there were no old versions and duplicate libraries in the External Libraries.
From the File menu:
Invalidate Cache ScreenShot
It's a pretty big hammer, though, requiring a restart of the app, and multi-minute rebuild of the IntelliSense index.
http://stackoverflow.com/questions/3348816/intellij-never-use-wildcard-imports
  1. File\Settings... (Ctrl+Alt+S)
  2. Project Settings > Code Style > Java > Imports tab
  3. Set Class count to use import with '*' to 999
  4. Set Names count to use static import with '*' to 999
https://www.jetbrains.com/help/idea/2016.2/finding-and-replacing-text-in-file.html
  1. From the main menu, choose Edit | Find | Replace, or press ⌘R. The search and replace pane appears on top of the active editor.
https://darekkay.com/2014/02/27/intellij-idea-shortcuts-for-eclipse-users/
F6F8Step over
F5F7Step into
Shift + F7Smart step into
F7Shift + F8Step out
Ctrl + RAlt + F9Run to cursor
Ctrl + UAlt + F8Evaluate expression
F8F9Resume program
Ctrl + Shift + BCtrl + F8Toggle breakpoint
Alt + Shift + Q, BCtrl + Shift + F8View breakpoints

https://www.jetbrains.com/help/idea/2016.2/choosing-a-method-to-step-into.html
  1. On the main menu, choose Run | Smart Step Into or press ⇧F7.
https://www.jetbrains.com/help/idea/2016.2/navigating-to-recent.html

Using multi-selection in the lists of recent files

  • To select non-adjacent files, use Ctrl + mouse click.
  • To select adjacent files, use Shift + mouse click.

































  1. On the main menu, choose View | Recent Files or press ⌘E.
  2. From the Recent Files pop-up window that opens select the desired file.

To navigate to a recently edited file

  1. On the main menu, choose View | Recently Changed Files or press ⇧⌘E.
  2. From the Recently Edited Files pop-up window that opens select the desired file.

To jump to the latest edit location

  • Do one of the following:
    • On the main menu, choose Navigate | Last Edit Location.
    • Press ⇧⌘⌫.


































To jump to the next edit location

  • On the main menu, choose Navigate | Next Edit Location.

  1. On the main menu, choose Navigate | Line, or press ⌘L.
http://stackoverflow.com/questions/18073545/eclipse-inspection-ctrl-shift-i-equivalent-in-intellij-community
Quick evaluate expression with Ctrl + Alt + F8 give me exactly what I want.
mac - alt+command+f8
http://stackoverflow.com/questions/7934876/intellij-idea-show-javadoc-automatically
http://stackoverflow.com/questions/7934876/intellij-idea-show-javadoc-automatically
Show Javadoc in IntelliJ IDEA 14:
  • When you write code:
    File -> Settings -> Editor -> General -> Code Completion -> Autopopup documentation in (ms)
It's only available when you press CTRL+SPACE It's more usable if you select the pin icon when it popups. The documentation window will be added to the tabs on the right. Later on I recommend to resize the window and to uncheck the Pinned property.
  • On mouse hover:
    File -> Settings -> Editor -> General -> Show quick documentation on mouse move
https://dzone.com/articles/become-polyglot-language
https://blog.jetbrains.com/idea/2009/03/user-defined-language-injection/
In IntelliJ IDEA you can quickly configure language injection for XML tags, attributes and Java method parameters and their return values. Just use Inject Language Intention on the code like this:
and it will immediately turn to:
And you get the complete coding assistance, with syntax and error highlighting, completion and navigation.
http://stackoverflow.com/questions/17571348/idea-equivalent-of-eclipse-type-hierarchy-f4
Is this the feature you are looking for? The shortcut is Ctrl+H
http://stackoverflow.com/questions/16671418/what-is-the-intellij-shortcut-key-to-create-a-javadoc-comment
Typing /** + then pressing Enter above a method signature will create Javadoc stubs for you.
You can use the action 'Fix doc comment'. It doesn't have a default shortcut, but you can assign the Alt+Shift+J shortcut to it in the Keymap, because this shortcut isn't used for anything else. By default, you can also press Ctrl+Shift+A two times and begin typing Fix doc comment in order to find the action.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206258509-Tomcat-and-Java-Heap-size-settings-from-Idea
In your Tomcat run/debug configuration setting, on the "Server" tab, there is a field labeled "VM Parameters". Enter the settings in there.
-Xms768m
-Xmx768m
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206227859-Where-are-Tomcat-log-files-generated-when-running-Tomcat-under-IDEA-
While IntelliJ is bringing up tomcat you get some deployment information logged to the screen. On my system it looks like this:
http://stackoverflow.com/questions/16784703/enable-partial-compile-intellij/16784855#16784855
Modify your configuration to use Make, no error check option instead of Make.

http://stackoverflow.com/questions/19364949/how-to-view-the-list-of-compile-errors-in-intellij
Switch to 'Problems' view in the Project pane: 
Enable the setting to compile the project automatically : 
http://stackoverflow.com/questions/14251624/intellij-idea-hide-iml-files
http://blog.coffeebeans.at/archives/984
Check “Ignored files and folders” in File Types settings:
File | Settings | Editor | File Types for Windows and Linux
IntelliJ IDEA | Preferences | Editor | File Types for OS X
Then add *.iml;*.idea; in the text box in the bottom:
https://www.jetbrains.com/help/idea/2016.2/adding-an-existing-module-to-a-project.html
  1. Open the project you want to add a module to, and select File | New | Module from Existing Sources.
https://www.jetbrains.com/help/idea/2016.2/configuring-color-scheme-for-consoles.html\
  1. Open the IDE Settings, and under Colors&Fonts, scroll through the list of components, and select the ones related to consoles:
    • Console Colors
    • Console Fonts
You need copy existing theme then change it.
https://www.jetbrains.com/help/idea/2016.2/zooming-in-the-editor.html
To change font size using the keyboard
Press ⇧⌘A.
In the popup frame, type Increase font size or Decrease font size, and then click ⏎.

Font grows larger or smaller.In the popup frame, type Reset font size, and click .

https://blog.jetbrains.com/idea/2014/03/postfix-completion/
Postfix code completion helps reduce backward caret jumps as you write code. It lets you transform an already typed expression to another one based on the postfix you added, the type of expression and its context. For example, the “.if” postfix applied to a boolean expression wraps it with an if statement. Likewise the “.notnull” triggers a surround template checking the expression for the null value.

serr
soutf

geti - create singleton getInstance method

Create new template - sfl4j log
Preferences > Editor > Live Template
You can do it easily with the Live Templates, you just have to go to Editor -> Live Templates -> others -> create new
And in these fields :
  • Abbreviation: log
  • Description: Add log line
  • Template text:
private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger($CLASS_NAME$.class);
  • Applicable in: Java: declaration
  • Edit variables: CLASS_NAME Expresion: className()
https://www.javacodegeeks.com/2014/01/code-faster-with-intellij-idea-live-templates.html
  • ifn – Inserts “if null” statement
  • inn – Inserts “if not null” statement
  • inst – Checks object type with instanceof and down-casts it
  • lazy – Performs lazy initialization
psf – public static final
psfi – public static final int
psfs – public static final String
thr – throw new

Common Actions:
Build -> Build Artifacts
http://stackoverflow.com/questions/8492205/cant-find-system-out-println
soutm (+TAB) ==> System.out.println("Class.And.Method.Name")
soutv (+TAB) ==> System.out.println("Last variable used = " + value);

sout - just print System.out.println()
soutm - added Class name & method name
soutp - added parameter
soutv - added last variable name
For 2016 version, the settings is on File > Settings > Editor > General > Code Completion > Case Sensitive Completion > None
https://www.jetbrains.com/help/idea/2016.2/keyboard-shortcuts-you-cannot-miss.html
Find action by name⇧⌘A
Show the list of available intention actions .⌥⏎
Switch between views (Project,Structure, etc.).⌥F1

Insert a live template.⌘J
Surround with a live template.⌥⌘J
Comment or uncomment a line or fragment of code with the line or block comment.⌘/
⌥⌘/
Find class or file by name.⌘O
⇧⌘O
Find/replace text string in the current file.⌘F
⌘R
Find/replace text in the project or in the specified directory⇧⌘F
⇧⌘R
Search everywhere.Double-press Shift
Quick view the usages of the selected symbol.⇧⌘F7
Expand or collapse a code fragment in the editor.⌘+
⌘-
Invoke code completion.⌃Space
Smart statement completion.⇧⌘⏎
Smart completion⌃⇧Space
Show the list of available refactorings (Refactor This).⌃T
  1. On the main menu, choose Code | Generate. Alternatively, right-click the editor and choose Generate on the context menu, or use ⌘N keyboard shortcut.
Generating main() method. Example of Applying a Simple Live Template
https://www.jetbrains.com/help/idea/2016.2/generating-main-method-example-of-applying-a-simple-live-template.html
https://mythinkpond.com/2011/04/27/intellij-live-template-main-method-generation/
Type “psvm” Ctrl+J will generate the main method.
Why “psvm”?
“public static void main”
“main” with Ctrl + J works by default on IntelliJ IDEA
https://mythinkpond.com/2011/02/18/intellij-serialversionuid-enabling/
If you are wondering why when you make a POJO bean to implement Serializable, IntelliJ does not throw any warnings to create the serialVersionUID variable… It’s because you need to enable it
https://medium.com/@fedor/intellij-tips-and-tricks-3e1dce6561a#.8q4r0m2cq
Last Edit Location (⌘⇧Delete). It allows you to jump to the location you were editing last. 
Back (⌘⌥←) and Forward (⌘⌥→) actions which allows to jump to previous and next caret locations.

Structure View (⌘F12)

going to a declaration of a method/function/class (⌘B or ⌘Click)

It is super handy to write less code and also it’s easier to read the code that way. But sometimes you want to know the actual type of a variable. Type Info action (⌃⇧P) will help you in this case.
Ok. Now you see the type of a variable but what if you want to navigate to the definition of the class? Type Declaration action (⌃⇧B) will do exactly what you want. And it works for expressions too!
While navigating through your code you are ending up opening a bunch of useless tabs in IntelliJ. By default it’s just 10 most recent tabs. Of course you can change the limit in Preferences -> Editor -> General -> Editor Tabs. But Quick Definition Action (⌘⇧I) will show the definition of a class/method/field etc in a pop-up and not in a new tab.  - alt+space
  • Find Usages ⌥F7
  • Find Usages in File ⌘F7
  • Highlight Usages in File ⌘⇧F7  - alt+f to search in file

This one is my personal favorite. Put a bookmark with F11 and search for one with ⇧F11. Simple as that. ???

Note: IntelliJ runs only light inspections on the fly. If you want to Run all available inspections use Analyze -> Inspect Code action.

Rename Refactoring (⇧F6is much smarter then a regular find and replace

It allows you to select logical blocks like an expression or a group of statements. Note: you can invoke Extend Selection (⌘W) action and Shrink Selection (⌘⇧W) action multiple times
- alt+up/down
Surround With (⌘⌥T) action works with statements and helps to surround them with another statement.

IntelliJ knows not only about hierarchy of the classes, but also about all the methods that you can override or should implement. Pop-ups for Override Methods (O) and Implement Methods(I) automatically show only methods eligible for the action.
- ctrl+o
-ctrl+I


http://osxdaily.com/2015/06/17/home-end-button-mac-keyboard-functions/

The “Home” button on a Mac keyboard: Fn + Left Arrow

The ‘fn’ key on the Mac keyboard is the function button, hitting that with the left arrow will immediately jump to the very top of a page in the active application of OS X. This is the exact same function as hitting the “Home” button on a Windows PC.

The “End” button on a Mac Keyboard: Fn + Right Arrow

fn+command+left arrow

https://dzone.com/articles/intellij-idea-small-tips-big
To see the magic, choose a block of code worth refactoring and instead of going up into the menu press Control + Shift + A and enter the name of the command you want to perform. Wild cards or incomplete names are of course allowed.

plugins
key promoter
https://www.eriwen.com/tools/best-intellij-plugin-ever-key-promoter/

https://plugins.jetbrains.com/search/topRated?pr=idea
7. String Manipulation
10. Grep Console
Maven Helper

Findbugs:
https://dzone.com/articles/intellij-idea-finds-bugs

http://stackoverflow.com/questions/11704327/how-to-optimize-imports-automatically-after-each-save-in-intellij
File > Settings > Plugins > Browse repositories... > Search 'Save Actions' > Category 'Code tools'

https://blog.jetbrains.com/idea/2014/07/try-intellij-idea-14-eap-138-1283-4-with-code-cleanup-android-studio-beta-features-and-more/
To use the feature, simply go to Analyse → Code Cleanup… menu.


https://confluence.jetbrains.com/display/IntelliJIDEA/Working+with+Scala+Worksheet
To create a Scala Worksheet, right-click on your project and select New→ Scala Worksheet:  

http://netlicensing.io/blog/2012/12/25/intellij-idea-how-to-generate-serialversionuid/
  • Go to “File” => “Settings… (Ctrl+Alt+S)” => “Inspections” => “Serialization issues”
  • … and enable “Serializable classes without ‘serialVersionUID’”

  • Then use the IntelliJ IDEA light bulb or press Alt+Enter to generate the field
http://stackoverflow.com/questions/5688800/eclipses-quick-access-equivalent-in-intellij
Main Menu | Search | Find Action (Ctrl+Shift+A) Command+Shift+A in mac
http://stackoverflow.com/questions/746109/intellij-idea-equivalent-of-eclipse-link-with-editor
At IntelliJ IDEA 12 (13, 14 and 15 from comments), it is located at the gear icon into the "Project" Tool Window, called as our mate said, Autoscroll from source
check the image
enter image description here

http://stackoverflow.com/questions/14127381/intellij-idea-12-code-completion-without-capitalisation
File -> Settings -> Editor -> Code completion -> Case sensitive completion
Install plugins:
IntelliJ IDEA > Preferences > Plugins

https://www.catalysts.cc/en/wissenswertes/intellij-idea-and-eclipse-shortcuts/
EclipseIntelliJ IDEADescription
F4ctrl+hshow the type hierarchy
ctrl+alt+gctrl+alt+F7find usages - mac: command+alt+F7
ctrl+shift+uctrl+f7finds the usages in the same file - alt+f7
alt+shift+rshift+F6rename
ctrl+shift+rctrl+shift+Nfind file / open resource  ???
ctrl+shift+x, jctrl+shift+F10run (java program)
ctrl+shift+octrl+alt+oorganize imports
ctrl+octrl+F12show current file structure / outline -> command+F12
ctrl+shift+mctrl+alt+Vcreate local variable refactoring
syso ctrl+spacesout ctrj+jSystem.out.println(“”)
alt + up/downctrl + shift + up/downmove lines
ctrl + dctrl + ydelete current line  ==> command+delete
???alt + hshow subversion history
ctrl + hctrl + shift + fsearch (find in path) -> command+shift+f
“semi” set in window-> preferencesctrl + shift + enterif I want to add the semi-colon at the end of a statement
ctrl + 1 or ctrl + shift + lctrl + alt + vintroduce local variable 
alt + shift + salt + insertgenerate getters / setters
ctrl + shift + fctrl + alt + lformat code-> command+alt+l
ctrl + yctrl + shift + zredo
ctrl + shift + cctrl + /comment out lines (my own IDEA shortcut definition for comment/uncomment on german keyboard layout on laptop: ctrl + shift + y)
ctrl + alt + hctrl + alt + h (same!)show call hierarchy
none ?ctrl + alt + f7to jump to one of the callers of a method
ctrl + shift + ialt + f8evaluate expression (in debugger)
F3ctrl + bgo to declaration (e.g. go to method)
ctrl + lctrl + ggo to line  -> command+l

Preferences > code style > import new format xml
https://www.jetbrains.com/help/idea/2016.2/keyboard-shortcuts-you-cannot-miss.html


Press SHIFT TWO times and you can search anything, both class and method in the whole project.
I know that Ctrl /Command in mac+ N is to find classes and it is very useful. But what about methods?

Alt+Enter
Eclipse's Ctrl+1 in IntelliJ and Android Studio
Personally I don't think AltEnter is particularly correct. Ctrl1 does lots of code generation like generating local variables given a method call etc.
CtrlAltV ... generates a local variable
CtrlAltF ... generate a field
AltInsert ... generate (drop down menu to generate all sorts)
Now, unrelated to the question but maybe helpful and in the same ball park is that the "foreach" short cut in IntelliJ is iter rather than for.

http://stackoverflow.com/questions/30500263/optimal-keymap-while-using-intelij-idea-on-linux-and-mac
This might be a litle bit subjective topic, but here is some information which might help you decide:
There are two main different predefined keymaps for OS X in IntelliJ (you can find them in Settings/Keymap).
  • Mac OS X
  • Mac OS X 10.5+
The Mac OS X keymap is similar to Linux/Windows keyboard. So if you need to switch between multiple systems this one is probably better for you.
The Mac OS X 10.5+ keyboard is designed to fit it into the OS X ecosystem so if you are used to general OS X shortcuts, this one will feel more natural and you will easily guess a lot of shortcuts.
Here is a reference for the Mac OS X 10.5+ keymap.
http://stackoverflow.com/questions/6796545/convert-existing-generics-to-diamond-syntax
Oh yes, I have successfully done this on IntelliJ (free Community Edition).
Menu > Analyze > Inspect Code...
In the result, select "Java language level migration aids > Explicity type can be replaced with <>"
Right click, run "Apply Fix 'Replace with <>'" And you got diamonds.
There was a bug about diamond on anomymous classes, so some code may not compile after the fix. You'll have to revert them back then.
// anonymous class, <> doesn't work.
new Factory<Pig>(){ ... }  
// however IntelliJ may wrongly "fix" it to
new Factory<>(){ ... }   // does not compile.

Other useful features:
spelling

Shortcuts:
https://resources.jetbrains.com/assets/products/intellij-idea/IntelliJIDEA_ReferenceCard_mac.pdf

http://stackoverflow.com/questions/746109/intellij-idea-equivalent-of-eclipse-link-with-editor
IntelliJ IDEA equivalent of Eclipse “Link with Editor”
That would be autoscrollFromSource.png : Autoscroll from Source.
Tomcat integration is available only in IntelliJ IDEA Ultimate Edition, while you are running the Community Edition. Here is the page that describes the difference between the editions.


Importing Gradle project - getting JAVA_HOME not defined yet
You need to setup a SDK for Java projects, like @rizzletang said, but you don't need to create a new project, you can do it from the Welcome screen.
On the bottom right, select Configure > Project Defaults > Project Structure
If you’re defining Kotlin APIs you don’t need non-null annotations. The entire language is non-null by default and only types suffixed with ? can be null.
https://www.jetbrains.com/help/idea/annotating-source-code.html

https://medium.com/square-corner-blog/non-null-is-the-default-58ffc0bb9111
code distracts from the real problems we’re solving. Thankfully, there’s a solution: JSR 305’s @ParametersAreNonnullByDefault indicates that everything in an entire package is non-null unless otherwise specified. Apply it by creating a package-info.java file in each package.

https://www.jetbrains.com/help/idea/parametersarenonnullbydefault-annotation.html
Annotation @ParametersAreNonnullByDefault gives the developer an option to define that for a given class or package all the elements (methods, parameters, fields and variables) have @NotNull semantic, unless they are explicitly annotated with the @Nullable annotation.

This is done by adding annotation @javax.annotation.ParametersAreNonnullByDefault to the entire package, class, or method.

https://blog.csdn.net/linsongbin1/article/details/80211919




Labels

Review (572) System Design (334) System Design - Review (198) Java (189) Coding (75) Interview-System Design (65) Interview (63) Book Notes (59) Coding - Review (59) to-do (45) Linux (43) Knowledge (39) Interview-Java (35) Knowledge - Review (32) Database (31) Design Patterns (31) Big Data (29) Product Architecture (28) MultiThread (27) Soft Skills (27) Concurrency (26) Cracking Code Interview (26) Miscs (25) Distributed (24) OOD Design (24) Google (23) Career (22) Interview - Review (21) Java - Code (21) Operating System (21) Interview Q&A (20) System Design - Practice (20) Tips (19) Algorithm (17) Company - Facebook (17) Security (17) How to Ace Interview (16) Brain Teaser (14) Linux - Shell (14) Redis (14) Testing (14) Tools (14) Code Quality (13) Search (13) Spark (13) Spring (13) Company - LinkedIn (12) How to (12) Interview-Database (12) Interview-Operating System (12) Solr (12) Architecture Principles (11) Resource (10) Amazon (9) Cache (9) Git (9) Interview - MultiThread (9) Scalability (9) Trouble Shooting (9) Web Dev (9) Architecture Model (8) Better Programmer (8) Cassandra (8) Company - Uber (8) Java67 (8) Math (8) OO Design principles (8) SOLID (8) Design (7) Interview Corner (7) JVM (7) Java Basics (7) Kafka (7) Mac (7) Machine Learning (7) NoSQL (7) C++ (6) Chrome (6) File System (6) Highscalability (6) How to Better (6) Network (6) Restful (6) CareerCup (5) Code Review (5) Hash (5) How to Interview (5) JDK Source Code (5) JavaScript (5) Leetcode (5) Must Known (5) Python (5)

Popular Posts