Skip to content

Commit f22b118

Browse files
committed
Minimise stubs
By removing all business logic from the stubs, we better test that our analysis treats them as opaque and does not rely on their internal structure
1 parent 45e1a61 commit f22b118

File tree

2 files changed

+8
-40
lines changed

2 files changed

+8
-40
lines changed

java/ql/test/stubs/jsr311-api-1.1.1/javax/ws/rs/core/Cookie.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ public class Cookie {
5656
* Cookies using the default version correspond to RFC 2109.
5757
*/
5858
public static final int DEFAULT_VERSION = 1;
59-
private final String name;
60-
private final String value;
61-
private final int version;
62-
private final String path;
63-
private final String domain;
6459

6560
/**
6661
* Create a new instance.
@@ -74,11 +69,6 @@ public class Cookie {
7469
*/
7570
public Cookie(final String name, final String value, final String path, final String domain, final int version)
7671
throws IllegalArgumentException {
77-
this.name = name;
78-
this.value = value;
79-
this.version = version;
80-
this.domain = domain;
81-
this.path = path;
8272
}
8373

8474
/**
@@ -92,7 +82,6 @@ public Cookie(final String name, final String value, final String path, final St
9282
*/
9383
public Cookie(final String name, final String value, final String path, final String domain)
9484
throws IllegalArgumentException {
95-
this(name, value, path, domain, DEFAULT_VERSION);
9685
}
9786

9887
/**
@@ -104,7 +93,6 @@ public Cookie(final String name, final String value, final String path, final St
10493
*/
10594
public Cookie(final String name, final String value)
10695
throws IllegalArgumentException {
107-
this(name, value, null, null);
10896
}
10997

11098
/**

java/ql/test/stubs/jsr311-api-1.1.1/javax/ws/rs/core/NewCookie.java

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,6 @@ public class NewCookie extends Cookie {
5757
*/
5858
public static final int DEFAULT_MAX_AGE = -1;
5959

60-
private final String comment;
61-
private final int maxAge;
62-
private final Date expiry;
63-
private final boolean secure;
64-
private final boolean httpOnly;
65-
6660
/**
6761
* Create a new instance.
6862
*
@@ -71,7 +65,7 @@ public class NewCookie extends Cookie {
7165
* @throws IllegalArgumentException if name is {@code null}.
7266
*/
7367
public NewCookie(String name, String value) {
74-
this(name, value, null, null, DEFAULT_VERSION, null, DEFAULT_MAX_AGE, null, false, false);
68+
super("", "");
7569
}
7670

7771
/**
@@ -93,7 +87,7 @@ public NewCookie(String name,
9387
String comment,
9488
int maxAge,
9589
boolean secure) {
96-
this(name, value, path, domain, DEFAULT_VERSION, comment, maxAge, null, secure, false);
90+
super("", "");
9791
}
9892

9993
/**
@@ -118,7 +112,7 @@ public NewCookie(String name,
118112
int maxAge,
119113
boolean secure,
120114
boolean httpOnly) {
121-
this(name, value, path, domain, DEFAULT_VERSION, comment, maxAge, null, secure, httpOnly);
115+
super("", "");
122116
}
123117

124118
/**
@@ -142,7 +136,7 @@ public NewCookie(String name,
142136
String comment,
143137
int maxAge,
144138
boolean secure) {
145-
this(name, value, path, domain, version, comment, maxAge, null, secure, false);
139+
super("", "");
146140
}
147141

148142
/**
@@ -171,12 +165,7 @@ public NewCookie(String name,
171165
Date expiry,
172166
boolean secure,
173167
boolean httpOnly) {
174-
super(name, value, path, domain, version);
175-
this.comment = comment;
176-
this.maxAge = maxAge;
177-
this.expiry = expiry;
178-
this.secure = secure;
179-
this.httpOnly = httpOnly;
168+
super("", "");
180169
}
181170

182171
/**
@@ -186,7 +175,7 @@ public NewCookie(String name,
186175
* @throws IllegalArgumentException if cookie is {@code null}.
187176
*/
188177
public NewCookie(Cookie cookie) {
189-
this(cookie, null, DEFAULT_MAX_AGE, null, false, false);
178+
super("", "");
190179
}
191180

192181
/**
@@ -199,7 +188,7 @@ public NewCookie(Cookie cookie) {
199188
* @throws IllegalArgumentException if cookie is {@code null}.
200189
*/
201190
public NewCookie(Cookie cookie, String comment, int maxAge, boolean secure) {
202-
this(cookie, comment, maxAge, null, secure, false);
191+
super("", "");
203192
}
204193

205194
/**
@@ -215,16 +204,7 @@ public NewCookie(Cookie cookie, String comment, int maxAge, boolean secure) {
215204
* @since 2.0
216205
*/
217206
public NewCookie(Cookie cookie, String comment, int maxAge, Date expiry, boolean secure, boolean httpOnly) {
218-
super(cookie == null ? null : cookie.getName(),
219-
cookie == null ? null : cookie.getValue(),
220-
cookie == null ? null : cookie.getPath(),
221-
cookie == null ? null : cookie.getDomain(),
222-
cookie == null ? Cookie.DEFAULT_VERSION : cookie.getVersion());
223-
this.comment = comment;
224-
this.maxAge = maxAge;
225-
this.expiry = expiry;
226-
this.secure = secure;
227-
this.httpOnly = httpOnly;
207+
super("", "");
228208
}
229209

230210
/**

0 commit comments

Comments
 (0)