View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.typeresolution.testdata;
5   
6   public class Promotion {
7   
8   	public void unaryNumericPromotion() {
9   		double t;
10  		t = +((byte)1);
11  		t = +((short)1);
12  		t = +((char)1);
13  		t = +((int)1);
14  		t = +((long)1);
15  		t = +((float)1);
16  		t = +((double)1);
17  	}
18  
19  	public void binaryNumericPromotion() {
20  		double t;
21  		t = ((byte)1) + ((byte)2);
22  		t = ((byte)1) + ((short)2);
23  		t = ((byte)1) + ((char)2);
24  		t = ((byte)1) + ((int)2);
25  		t = ((byte)1) + ((long)2);
26  		t = ((byte)1) + ((float)2);
27  		t = ((byte)1) + ((double)2);
28  		t = ((short)1) + ((byte)2);
29  		t = ((short)1) + ((short)2);
30  		t = ((short)1) + ((char)2);
31  		t = ((short)1) + ((int)2);
32  		t = ((short)1) + ((long)2);
33  		t = ((short)1) + ((float)2);
34  		t = ((short)1) + ((double)2);
35  		t = ((char)1) + ((byte)2);
36  		t = ((char)1) + ((short)2);
37  		t = ((char)1) + ((char)2);
38  		t = ((char)1) + ((int)2);
39  		t = ((char)1) + ((long)2);
40  		t = ((char)1) + ((float)2);
41  		t = ((char)1) + ((double)2);
42  		t = ((int)1) + ((byte)2);
43  		t = ((int)1) + ((short)2);
44  		t = ((int)1) + ((char)2);
45  		t = ((int)1) + ((int)2);
46  		t = ((int)1) + ((long)2);
47  		t = ((int)1) + ((float)2);
48  		t = ((int)1) + ((double)2);
49  		t = ((long)1) + ((byte)2);
50  		t = ((long)1) + ((short)2);
51  		t = ((long)1) + ((char)2);
52  		t = ((long)1) + ((int)2);
53  		t = ((long)1) + ((long)2);
54  		t = ((long)1) + ((float)2);
55  		t = ((long)1) + ((double)2);
56  		t = ((float)1) + ((byte)2);
57  		t = ((float)1) + ((short)2);
58  		t = ((float)1) + ((char)2);
59  		t = ((float)1) + ((int)2);
60  		t = ((float)1) + ((long)2);
61  		t = ((float)1) + ((float)2);
62  		t = ((float)1) + ((double)2);
63  		t = ((double)1) + ((byte)2);
64  		t = ((double)1) + ((short)2);
65  		t = ((double)1) + ((char)2);
66  		t = ((double)1) + ((int)2);
67  		t = ((double)1) + ((long)2);
68  		t = ((double)1) + ((float)2);
69  		t = ((double)1) + ((double)2);
70  	}
71  
72  	public void binaryStringPromotion() {
73  		String t;
74  		t = "" + 0;
75  		t = 0 + "";
76  		t = "" + "";
77  		t = "" + null;
78  		t = null + "";
79  	}
80  }