Skip to main content
added 421 characters in body
Source Link
Amogh
  • 4.6k
  • 11
  • 53
  • 117

I usually work with IntelliJ but recently one of my team mate opened project in eclipse and he found eclipse showing error Type mismatch: cannot convert from Object to boolean in 2 separate java files. I crossed checked in IntelliJ but no error.

Below are the screenshot from Eclipse and IntelliJ respectively:

Eclipse:

enter image description here

IntelliJ

enter image description here

I also checked that both the IDEs have same compiler compliance level, i.e. 11

Eclipse:

enter image description here

IntelliJ

enter image description here

Even though Eclipse is showing error, if I run the project in eclipse then build and run is successful. Here is the reproducible example.

Note: As in above actual code example row object is created from an interface, I do not have access to see it's actual implementation. Hence the reproducible example is created just to generate the scenario, to so that I can understand why and how two different IDEs behave differently ? And why even in Eclipse code is running without any errorI have created below reproducible example:

IRow.java:

public interface IRow { <T> T getValue(); } 

RowImpl.java

public class RowImpl implements IRow { @SuppressWarnings("unchecked") @Override public <T> T getValue() { return (T) Boolean.TRUE; } } 

and the main.java

public class main { public static void main(String args[]) { IRow row = new RowImpl(); if(row.getValue()) //--> Eclipse shows error but IntelliJ not System.out.println("value is true"); } } 

I usually work with IntelliJ but recently one of my team mate opened project in eclipse and he found eclipse showing error Type mismatch: cannot convert from Object to boolean in 2 separate java files. I crossed checked in IntelliJ but no error.

Below are the screenshot from Eclipse and IntelliJ respectively:

Eclipse:

enter image description here

IntelliJ

enter image description here

I also checked that both the IDEs have same compiler compliance level, i.e. 11

Eclipse:

enter image description here

IntelliJ

enter image description here

Even though Eclipse is showing error, if I run the project in eclipse then build and run is successful. Here is the reproducible example.

Note: As in above actual code example row object is created from an interface, I do not have access to see it's actual implementation. Hence the reproducible example is created just to generate the scenario, to understand why and how two different IDEs behave differently ? And why even in Eclipse code is running without any error

I usually work with IntelliJ but recently one of my team mate opened project in eclipse and he found eclipse showing error Type mismatch: cannot convert from Object to boolean in 2 separate java files. I crossed checked in IntelliJ but no error.

Below are the screenshot from Eclipse and IntelliJ respectively:

Eclipse:

enter image description here

IntelliJ

enter image description here

I also checked that both the IDEs have same compiler compliance level, i.e. 11

Eclipse:

enter image description here

IntelliJ

enter image description here

Even though Eclipse is showing error, if I run the project in eclipse then build and run is successful.

As in above actual code example row object is created from an interface, I do not have access to see it's actual implementation. Hence just to generate the scenario so that I can understand why and how two different IDEs behave differently ? I have created below reproducible example:

IRow.java:

public interface IRow { <T> T getValue(); } 

RowImpl.java

public class RowImpl implements IRow { @SuppressWarnings("unchecked") @Override public <T> T getValue() { return (T) Boolean.TRUE; } } 

and the main.java

public class main { public static void main(String args[]) { IRow row = new RowImpl(); if(row.getValue()) //--> Eclipse shows error but IntelliJ not System.out.println("value is true"); } } 
added 57 characters in body
Source Link
Amogh
  • 4.6k
  • 11
  • 53
  • 117

I usually work with IntelliJ but recently one of my team mate opened project in eclipse and he found eclipse showing error Type mismatch: cannot convert from Object to boolean in 2 separate java files. I crossed checked in IntelliJ but no error. And strange thing is if I run the project in eclipse then build and run is successful.

Below are the screenshot from Eclipse and IntelliJ respectively:

Eclipse:

enter image description here

IntelliJ

enter image description here

I also checked that both the IDEs have same compiler compliance level, i.e. 11

Eclipse:

enter image description here

IntelliJ

enter image description here

Even though Eclipse is showing error, if I run the project in eclipse then build and run is successful. Here is the reproducible example.

Note: As in above actual code example row object is created from an interface, I do not have access to see it's actual implementation. Hence the reproducible example is created just to generate the scenario, to understand why and how two different IDEs behave differently ? And why even in Eclipse code is running without any error

I usually work with IntelliJ but recently one of my team mate opened project in eclipse and he found eclipse showing error Type mismatch: cannot convert from Object to boolean in 2 separate java files. I crossed checked in IntelliJ but no error. And strange thing is if I run the project in eclipse then build and run is successful.

Below are the screenshot from Eclipse and IntelliJ respectively:

Eclipse:

enter image description here

IntelliJ

enter image description here

I also checked that both the IDEs have same compiler compliance level, i.e. 11

Eclipse:

enter image description here

IntelliJ

enter image description here

Even though Eclipse is showing error, if I run the project in eclipse then build and run is successful. Here is the reproducible example.

Note: As in above actual code example row object is created from an interface, I do not have access to see it's actual implementation. Hence the reproducible example is created just to generate the scenario, to understand why and how two different IDEs behave differently ?

I usually work with IntelliJ but recently one of my team mate opened project in eclipse and he found eclipse showing error Type mismatch: cannot convert from Object to boolean in 2 separate java files. I crossed checked in IntelliJ but no error.

Below are the screenshot from Eclipse and IntelliJ respectively:

Eclipse:

enter image description here

IntelliJ

enter image description here

I also checked that both the IDEs have same compiler compliance level, i.e. 11

Eclipse:

enter image description here

IntelliJ

enter image description here

Even though Eclipse is showing error, if I run the project in eclipse then build and run is successful. Here is the reproducible example.

Note: As in above actual code example row object is created from an interface, I do not have access to see it's actual implementation. Hence the reproducible example is created just to generate the scenario, to understand why and how two different IDEs behave differently ? And why even in Eclipse code is running without any error

added 278 characters in body
Source Link
Amogh
  • 4.6k
  • 11
  • 53
  • 117

I usually work with IntelliJ but recently one of my team mate opened project in eclipse and he found eclipse showing error Type mismatch: cannot convert from Object to boolean in 2 separate java files. I crossed checked in IntelliJ but no error. And strange thing is if I run the project in eclipse then build and run is successful.

Below are the screenshot from Eclipse and IntelliJ respectively:

Eclipse:

enter image description here

IntelliJ

enter image description here

I also checked that both the IDEs have same compiler compliance level, i.e. 11

Eclipse:

enter image description here

IntelliJ

enter image description here

Even though Eclipse is showing error, if I run the project in eclipse then build and run is successful. Here is the reproducible example.

Note: As in above actual code example row object is created from an interface, I do not have access to see it's actual implementation. Hence the reproducible example is created just to generate the scenario, to understand why and how two different IDEs behave differently ?

I usually work with IntelliJ but recently one of my team mate opened project in eclipse and he found eclipse showing error Type mismatch: cannot convert from Object to boolean in 2 separate java files. I crossed checked in IntelliJ but no error. And strange thing is if I run the project in eclipse then build and run is successful.

Below are the screenshot from Eclipse and IntelliJ respectively:

Eclipse:

enter image description here

IntelliJ

enter image description here

I also checked that both the IDEs have same compiler compliance level, i.e. 11

Eclipse:

enter image description here

IntelliJ

enter image description here

Even though Eclipse is showing error, if I run the project in eclipse then build and run is successful. Here is the reproducible example.

I usually work with IntelliJ but recently one of my team mate opened project in eclipse and he found eclipse showing error Type mismatch: cannot convert from Object to boolean in 2 separate java files. I crossed checked in IntelliJ but no error. And strange thing is if I run the project in eclipse then build and run is successful.

Below are the screenshot from Eclipse and IntelliJ respectively:

Eclipse:

enter image description here

IntelliJ

enter image description here

I also checked that both the IDEs have same compiler compliance level, i.e. 11

Eclipse:

enter image description here

IntelliJ

enter image description here

Even though Eclipse is showing error, if I run the project in eclipse then build and run is successful. Here is the reproducible example.

Note: As in above actual code example row object is created from an interface, I do not have access to see it's actual implementation. Hence the reproducible example is created just to generate the scenario, to understand why and how two different IDEs behave differently ?

added 121 characters in body
Source Link
Amogh
  • 4.6k
  • 11
  • 53
  • 117
Loading
added 52 characters in body
Source Link
Amogh
  • 4.6k
  • 11
  • 53
  • 117
Loading
Source Link
Amogh
  • 4.6k
  • 11
  • 53
  • 117
Loading