You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running Java code I have noticed that some compile time errors will not be displayed. For example, the following code should throw an error, "HashMap<Integer, Integer> hashMapName = new HashMap<Integer, String>();" Instead of seeing, "Unresolved compilation problems:
Type mismatch: cannot convert from HashMap<Integer,Integer> to HashMap<Integer,String>
The method put(Integer, String) in the type HashMap<Integer,String> is not applicable for the arguments (int, int)" The compiler displays, "Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at Test.main(Test.java:8)" If I want to see the error message then I have to read the class file in order to determin what the error is and where it is located. I was able to reproduce the bug in a small and simple Java file. I noticed that the bug shows up when I declare the like, "HashMap<dataTypeA, dataTypeB> name = new HashMap<dataTypeC, dataTypeD>" Where dataType A - D could be any data type I want it to be. The bug only occors when dataTypeC is different from dataTypeA and or dataTypeD is differnt from dataTypeB.
The text was updated successfully, but these errors were encountered:
key6oardWarrior
changed the title
Visual Studio Code's Java Compiler Not Showing Errors
Visual Studio Code's Java Compiler Not Showing Certain Errors
Dec 6, 2019
When running Java code I have noticed that some compile time errors will not be displayed. For example, the following code should throw an error, "HashMap<Integer, Integer> hashMapName = new HashMap<Integer, String>();" Instead of seeing, "Unresolved compilation problems:
Type mismatch: cannot convert from HashMap<Integer,Integer> to HashMap<Integer,String>
The method put(Integer, String) in the type HashMap<Integer,String> is not applicable for the arguments (int, int)" The compiler displays, "Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The text was updated successfully, but these errors were encountered: