Skip to content

Commit 662d792

Browse files
committed
Merge branch 'master' into genericsTake2
2 parents d0e3d02 + 4af691d commit 662d792

28 files changed

Lines changed: 1182 additions & 102 deletions

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
<!-- GPL -->
230230
<groupId>com.mysql</groupId>
231231
<artifactId>mysql-connector-j</artifactId>
232-
<version>8.3.0</version>
232+
<version>9.4.0</version>
233233
<type>jar</type>
234234
<scope>compile</scope>
235235
</dependency>
@@ -396,7 +396,7 @@
396396
<dependency>
397397
<groupId>com.squareup.okio</groupId>
398398
<artifactId>okio-jvm</artifactId>
399-
<version>3.10.0</version>
399+
<version>3.16.0</version>
400400
</dependency>
401401
<dependency>
402402
<groupId>com.google.code.gson</groupId>

src/main/java/com/laytonsmith/core/ArgumentValidation.java

Lines changed: 73 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.laytonsmith.core.constructs.CNumber;
2222
import com.laytonsmith.core.constructs.CString;
2323
import com.laytonsmith.core.constructs.CVoid;
24+
import com.laytonsmith.core.constructs.InstanceofUtil;
2425
import com.laytonsmith.core.constructs.LeftHandSideType;
2526
import com.laytonsmith.core.constructs.Target;
2627
import com.laytonsmith.core.exceptions.ConfigRuntimeException;
@@ -46,6 +47,9 @@ private ArgumentValidation() {
4647
//
4748
}
4849

50+
/**
51+
* @deprecated Use {@link #getItemFromArray(CArray, String, Target, Mixed, Environment)} instead.
52+
*/
4953
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
5054
@Deprecated
5155
public static Mixed getItemFromArray(CArray object, String key, Target t, Mixed defaultItem) throws ConfigRuntimeException {
@@ -77,6 +81,9 @@ public static Mixed getItemFromArray(CArray object, String key, Target t, Mixed
7781
}
7882
}
7983

84+
/**
85+
* @deprecated Use {@link #getArray(Mixed, Target, Environment)} instead.
86+
*/
8087
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
8188
@Deprecated
8289
public static CArray getArray(Mixed construct, Target t) {
@@ -129,6 +136,9 @@ public static <T extends Mixed> T getObject(Mixed construct, Target t, Class<T>
129136
}
130137
}
131138

139+
/**
140+
* @deprecated Use {@link #getNumber(Mixed, Target, Environment)} instead.
141+
*/
132142
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
133143
@Deprecated
134144
public static double getNumber(Mixed c, Target t) {
@@ -198,6 +208,9 @@ public static double getNumber(Mixed c, Target t, Environment env) {
198208
+ ")[\\x00-\\x20]*" // trailing whitespace
199209
);
200210

211+
/**
212+
* @deprecated Use {@link #isNumber(Mixed, Environment)} instead.
213+
*/
201214
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
202215
@Deprecated
203216
public static boolean isNumber(Mixed c) {
@@ -217,6 +230,9 @@ public static boolean isNumber(Mixed c, Environment env) {
217230
return c instanceof CNumber || VALID_DOUBLE.matcher(c.val()).matches();
218231
}
219232

233+
/**
234+
* @deprecated Use {@link #getDouble(Mixed, Target, Environment)} instead.
235+
*/
220236
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
221237
@Deprecated
222238
public static double getDouble(Mixed c, Target t) {
@@ -244,6 +260,9 @@ public static double getDouble(Mixed c, Target t, Environment env) {
244260
}
245261
}
246262

263+
/**
264+
* @deprecated Use {@link #getDouble32(Mixed, Target, Environment)} instead.
265+
*/
247266
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
248267
@Deprecated
249268
public static float getDouble32(Mixed c, Target t) {
@@ -268,6 +287,9 @@ public static float getDouble32(Mixed c, Target t, Environment env) {
268287
return (float) l;
269288
}
270289

290+
/**
291+
* @deprecated Use {@link #getInt(Mixed, Target, Environment)} instead.
292+
*/
271293
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
272294
@Deprecated
273295
public static long getInt(Mixed c, Target t) {
@@ -309,6 +331,9 @@ public static long getInt(Mixed c, Target t, Environment env) {
309331
return i;
310332
}
311333

334+
/**
335+
* @deprecated Use {@link #getInt32(Mixed, Target, Environment)} instead.
336+
*/
312337
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
313338
@Deprecated
314339
public static int getInt32(Mixed c, Target t) {
@@ -339,6 +364,9 @@ public static int getInt32(Mixed c, Target t, Environment env) {
339364
return i;
340365
}
341366

367+
/**
368+
* @deprecated Use {@link #getInt16(Mixed, Target, Environment)} instead.
369+
*/
342370
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
343371
@Deprecated
344372
public static short getInt16(Mixed c, Target t) {
@@ -369,6 +397,9 @@ public static short getInt16(Mixed c, Target t, Environment env) {
369397
return s;
370398
}
371399

400+
/**
401+
* @deprecated Use {@link #getInt8(Mixed, Target, Environment)} instead.
402+
*/
372403
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
373404
@Deprecated
374405
public static byte getInt8(Mixed c, Target t) {
@@ -399,6 +430,9 @@ public static byte getInt8(Mixed c, Target t, Environment env) {
399430
return b;
400431
}
401432

433+
/**
434+
* @deprecated Use {@link #getBooleanObject(Mixed, Target, Environment)} instead.
435+
*/
402436
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
403437
@Deprecated
404438
public static boolean getBooleanObject(Mixed c, Target t) {
@@ -422,6 +456,9 @@ public static boolean getBooleanObject(Mixed c, Target t, Environment env) {
422456
return getBooleanish(c, t, env);
423457
}
424458

459+
/**
460+
* @deprecated Use {@link #getBoolean(Mixed, Target, Environment)} instead.
461+
*/
425462
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
426463
@Deprecated
427464
public static boolean getBoolean(Mixed c, Target t) {
@@ -440,12 +477,15 @@ public static boolean getBoolean(Mixed c, Target t) {
440477
* Generally speaking, if it seems reasonable for the user to send a non-boolean data type in this parameter, then
441478
* getBooleanish should be used. If it indicates a probable error, getBooleanObject should be used.
442479
*/
443-
@Deprecated
444480
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
481+
@Deprecated
445482
public static boolean getBoolean(Mixed c, Target t, Environment env) {
446483
return getBooleanish(c, t, env);
447484
}
448485

486+
/**
487+
* @deprecated Use {@link #getBooleanish(Mixed, Target, Environment)} instead.
488+
*/
449489
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
450490
@Deprecated
451491
public static boolean getBooleanish(Mixed c, Target t) {
@@ -478,11 +518,14 @@ public static boolean getBooleanish(Mixed c, Target t, Environment env) {
478518
return false;
479519
}
480520
if(c.isInstanceOf(Booleanish.TYPE, null, env)) {
481-
return ((Booleanish) c).getBooleanValue(env, t);
521+
return ((Booleanish) c).getBooleanValue(t, env);
482522
}
483523
throw new CRECastException("Could not convert value of type " + c.typeof(env) + " to a " + Booleanish.TYPE, t);
484524
}
485525

526+
/**
527+
* @deprecated Use {@link #getByteArray(Mixed, Target, Environment)} instead.
528+
*/
486529
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
487530
@Deprecated
488531
public static CByteArray getByteArray(Mixed c, Target t) {
@@ -541,6 +584,9 @@ public static String getString(Mixed c, Target t) {
541584
return c.val();
542585
}
543586

587+
/**
588+
* @deprecated Use {@link #getStringObject(Mixed, Target, Environment)} instead.
589+
*/
544590
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
545591
@Deprecated
546592
public static String getStringObject(Mixed c, Target t) {
@@ -563,29 +609,34 @@ public static String getStringObject(Mixed c, Target t, Environment env) {
563609
return c.val();
564610
}
565611

612+
/**
613+
* @deprecated Use {@link #anyDoubles(Environment, Mixed...)} instead.
614+
*/
566615
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
567616
@Deprecated
568617
public static boolean anyDoubles(Mixed... c) {
569618
return anyDoubles(null, c);
570619
}
571620

572621
/**
573-
* Returns true if any of the constructs are a CDouble, false otherwise
622+
* Returns true if any of the constructs are a CDouble, false otherwise.
574623
*
575624
* @param env
576-
*
577625
* @param c
578626
* @return
579627
*/
580628
public static boolean anyDoubles(Environment env, Mixed... c) {
581629
for(Mixed c1 : c) {
582-
if(c1 instanceof CDouble || c1 instanceof CString && c1.val().indexOf(".", 1) > -1) {
630+
if(InstanceofUtil.isInstanceof(c1, CDouble.class, env) || InstanceofUtil.isInstanceof(c1, CString.class, env) && c1.val().indexOf(".", 1) > -1) {
583631
return true;
584632
}
585633
}
586634
return false;
587635
}
588636

637+
/**
638+
* @deprecated Use {@link #anyStrings(Environment, Mixed...)} instead.
639+
*/
589640
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
590641
@Deprecated
591642
public static boolean anyStrings(Mixed... c) {
@@ -601,19 +652,18 @@ public static boolean anyStrings(Mixed... c) {
601652
*/
602653
public static boolean anyStrings(Environment env, Mixed... c) {
603654
for(Mixed c1 : c) {
604-
if(c1 instanceof CString) {
655+
if(InstanceofUtil.isInstanceof(c1, CString.class, env)) {
605656
return true;
606657
}
607658
}
608659
return false;
609660
}
610661

611662
/**
612-
* Returns true if any of the constructs are null
613-
*
614-
* @param c
615-
* @return
663+
* @deprecated Use {@link #anyNulls(Environment, Mixed...)} instead.
616664
*/
665+
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
666+
@Deprecated
617667
public static boolean anyNulls(Mixed... c) {
618668
return anyNulls(null, c);
619669
}
@@ -635,11 +685,10 @@ public static boolean anyNulls(Environment env, Mixed... c) {
635685
}
636686

637687
/**
638-
* Returns true if any of the constructs are CBooleans, false otherwise.
639-
*
640-
* @param c
641-
* @return
688+
* @deprecated Use {@link #anyBooleans(Environment, Mixed...)} instead.
642689
*/
690+
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
691+
@Deprecated
643692
public static boolean anyBooleans(Mixed... c) {
644693
return anyBooleans(null, c);
645694
}
@@ -690,10 +739,18 @@ public static <T extends Enum<T>> T getEnum(Mixed c, Class<T> enumClass, Target
690739
}
691740

692741
/**
693-
* Returns a set of the given enum value.The input value may be either a single value or an array. If it is a single
742+
* @deprecated Use {@link #getEnumSet(Mixed, Class, Target, Environment)} instead.
743+
*/
744+
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
745+
@Deprecated
746+
public static <T extends Enum<T>> Set<T> getEnumSet(Mixed c, Class<T> enumClass, Target t) {
747+
return getEnumSet(c, enumClass, t, null);
748+
}
749+
750+
/**
751+
* Returns a set of the given enum value. The input value may be either a single value or an array. If it is a single
694752
* value, the set will be of size 1. Null is also supported, and will return a set of size 0. Internally, uses
695753
* {@link #getEnum}, so the behavior will generally be consistent with that.
696-
*
697754
* @param <T>
698755
* @param c
699756
* @param enumClass

0 commit comments

Comments
 (0)