Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

proposed method selection precendece rules for numbers:

 

byte

Byte

short

Short

int

Integer

long

Long

BigInteger

float

Float

double

Double

BigDecimal

Number

Object

byte

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Byte

1

0

2

3

4

5

6

7

8

9

10

11

12

13

14

15

short

(red star)

(red star)

0

1

2

3

4

5

6

7

8

9

10

11

12

13

Short

(red star)

(red star)

1

0

2

3

4

5

6

7

8

9

10

11

12

13

int

(red star)

(red star)

(red star)

(red star)

0

1

2

3

4

5

6

7

8

9

10

11

Integer

(red star)

(red star)

(red star)

(red star)

1

0

2

3

4

5

6

7

8

9

10

11

long

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

0

1

2

3

4

5

6

7

8

9

Long

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

1

0

2

3

4

5

6

7

8

9

BigInteger

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

0

1

2

3

4

5

6

7

float

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

0

1

2

3

4

5

6

Float

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

1

0

2

3

4

5

6

double

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

0

1

2

3

4

Double

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

1

0

2

3

4

BigDecimal

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

0

1

2

Number

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

0

1

Object

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

(red star)

0

(red star) = not possible. A lower number means that type is prefered over a type with a higher number.

for example calling a method foo with an argument of type Short, and I have these methods:

def foo(long y){}
def foo(BigDecimal y){}

Then the method with the long is used, because it gets the number 4 and BigDecimal 11.