Skip to content

LazilyParsedNumber does not implement eqals and hashCode methods #627

@GoogleCodeExporter

Description

@GoogleCodeExporter
test case to reproduce the issue

package com.google.gson.internal;

import junit.framework.TestCase;

public class LazilyParsedNumberTest extends TestCase {

    public void testHashCode(){
        LazilyParsedNumber n1 = new LazilyParsedNumber("1");
        LazilyParsedNumber n1Another = new LazilyParsedNumber("1");
        assertEquals(n1.hashCode(), n1Another.hashCode());
    }

    public void testEquals(){
        LazilyParsedNumber n1 = new LazilyParsedNumber("1");
        LazilyParsedNumber n1Another = new LazilyParsedNumber("1");
        assertTrue(n1.equals(n1Another));
    }


What is the expected output? What do you see instead?
Any class should implement hashCode and equals when implementing Number 
interface.

What version of the product are you using? On what operating system?
2.3

Please provide any additional information below.
https://code.google.com/p/google-gson/issues/detail?id=523
Similar one.

I could work on these, but first I would like to know if there was any reason 
you decided not to implement these methods? 

Original issue reported on code.google.com by vrab...@gmail.com on 4 Feb 2015 at 12:06

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions