This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 253831 - [81cat] Java hint: EqualsOnIncompatibleTypes test case is incorrect
Summary: [81cat] Java hint: EqualsOnIncompatibleTypes test case is incorrect
Status: RESOLVED FIXED
Alias: None
Product: qa
Classification: Unclassified
Component: Test Specifications (show other bugs)
Version: 8.1
Hardware: PC Windows 8 x64
: P3 normal (vote)
Assignee: Jiri Prox
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-27 07:11 UTC by cezariusz
Modified: 2015-08-12 13:24 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cezariusz 2015-07-27 07:11:40 UTC
Link: http://services.netbeans.org/synergy/client/app/#/case/4989/suite/1691

Product Version: NetBeans IDE Dev (Build 201507240001)
Java: 1.8.0_51; Java HotSpot(TM) 64-Bit Server VM 25.51-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_51-b16
System: Windows 8 version 6.2 running on amd64; UTF-8; pl_PL (nb)

public class _EqualsOnIncompatibleTypes {

    public void test() {
        char[] array1 = {'a', 'b', 'c'};
        int[] array2 = {1, 2};
        if (array1.equals(array2)) { //HINT: .equals on Incompatible Types
        }
    }
}

There is no expected hint in this case. There's only a hint ".equals() called on array". The hint works however for example on the following test case:

    public void test() {
        Integer integer = 10;
        Character character = 'a';
        if (integer.equals(character)) {
        }
    }
Comment 1 cezariusz 2015-07-27 07:13:07 UTC
BTW: why some of the test cases' files start with an underscore, and some start with lowercase letter? Does it mean something?
Comment 2 Svata Dedic 2015-07-30 12:34:18 UTC
if (array1.equals(array2)) does not equal incompatible types, but rather two arrays. Here, equals is misleading, since array object does not define hashCode() or equals(), so array1.equals(array2) <=> array1 == array2.
Comment 3 Jiri Prox 2015-08-12 13:21:09 UTC
(In reply to cezariusz from comment #1)
> BTW: why some of the test cases' files start with an underscore, and some
> start with lowercase letter? Does it mean something?

The name of class should match the name of the hint. Only the leading '.' is replaced by '_'
Comment 4 Jiri Prox 2015-08-12 13:24:07 UTC
I've fixed the sample file, thanks for providing the correct code