Repository navigation
Expand file tree
/
Copy pathClassWithConstants.java
More file actions
89 lines (78 loc) · 2.86 KB
/
Copy pathClassWithConstants.java
File metadata and controls
89 lines (78 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* SonarQube Java
* Copyright (C) 2012-2025 SonarSource Sàrl
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Sonar Source-Available License for more details.
*
* You should have received a copy of the Sonar Source-Available License
* along with this program; if not, see https://sonarsource.com/license/ssal/
*/
package org.sonar.java.model.expression;
import static java.lang.Boolean.TRUE;
// used by AssessableExpressionTreeTest
public class ClassWithConstants {
public static final String CONSTANT1 = "abc";
public static final String CONSTANT2 = CONSTANT1 + "def";
public static final int INT_CONSTANT1 = 42;
public static final long LONG_CONSTANT1 = 99L;
public static final Object OBJECT_CONSTANT = new Object();
public static final boolean BOOLEAN_CONSTANT = false;
public static final char QUESTION_MARK = '?';
public void characters() {
System.out.println(QUESTION_MARK);
System.out.println(ClassWithConstants.QUESTION_MARK);
System.out.println("WHERE id = " + QUESTION_MARK);
}
public void literals(String param) {
System.out.println("hello");
System.out.println(true);
System.out.println(43);
System.out.println(+43);
System.out.println(-43);
System.out.println(77L);
System.out.println(+77L);
System.out.println(-77L);
System.out.println(param);
System.out.println(1_000);
System.out.println(0x99567L);
}
public void identifiers(String param) {
System.out.println(CONSTANT1);
System.out.println(CONSTANT2);
System.out.println(INT_CONSTANT1);
System.out.println(LONG_CONSTANT1);
System.out.println(TRUE);
System.out.println(BOOLEAN_CONSTANT);
}
public void parentheses(String parentheses) {
System.out.println(((CONSTANT1)));
System.out.println(((INT_CONSTANT1)));
}
public void memberSelect(String parentheses) {
System.out.println(ClassWithConstants.CONSTANT1);
System.out.println(Boolean.TRUE);
System.out.println(Boolean.FALSE);
}
public void plus(String param) {
System.out.println("hello " + CONSTANT1);
System.out.println("hello " + param);
System.out.println(param + "hello ");
System.out.println("hello" + INT_CONSTANT1);
System.out.println(INT_CONSTANT1 + "hello");
System.out.println(INT_CONSTANT1 + 1);
System.out.println(LONG_CONSTANT1 + 1);
System.out.println(2 + LONG_CONSTANT1);
System.out.println(3L + LONG_CONSTANT1);
}
public void other() {
System.out.println(String.valueOf(1));
System.out.println(OBJECT_CONSTANT);
}
}