Zdravím konferenci!

Přišel jsem na neočekávané chování výčtových typů.

Pokud získáte výčtový typ přes remote stateless bean, tak nefunguje equals.
Setkal jste se s tím někdo?
Nedělám něco špatně?

/**
* Testovaci zdrojove kody
*/
// soubor TestEnum.java
public enum TestEnum {
    ONE,TWO;
}

// Stateless bean  (implementace) vraci toto:
public TestEnum getTestEnum(){
        return TestEnum.ONE;
}

// Testovani
TestEnum one=TestEnum.ONE;
TestEnum one1=instance.getTestEnum();  // instance je instance Stateless
beanu pres lookup
       
System.out.println("one xxx one1 == "+one+" xxx "+one1);
System.out.println("one.equals(one1) == "+one.equals(one1));

// vystup -- POROVNANI DVOU STEJNYCH VYCTOVYCH TYPU je FALSE
one xxx one1 == ONE xxx ONE
one.equals(one1) == false


Fafi

Odpovedet emailem