forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GPLv2 + Classpath exception compliance: ship the source code of jform…
…atstring Technically, jformatstring has no problem because we were shiping the source of in the jar file itself but that's easier to keep track of it if we actually vendor the source and build from the source. -- Change-Id: I80fc47ddeafc60263db47f33bfa9a2f2d7e2188d Reviewed-on: https://bazel-review.googlesource.com/#/c/3914 MOS_MIGRATED_REVID=126174813
- Loading branch information
Showing
15 changed files
with
1,637 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
licenses(["restricted"]) # GNU GPL v2 with Classpath exception | ||
|
||
filegroup( | ||
name = "srcs", | ||
srcs = glob(["**"]), | ||
) | ||
|
||
java_library( | ||
name = "jformatstring", | ||
srcs = glob(["java/**"]), | ||
) | ||
|
||
load("//tools/build_rules:java_rules_skylark.bzl", "bootstrap_java_library") | ||
|
||
bootstrap_java_library( | ||
name = "bootstrap", | ||
srcs = glob(["java/**"]), | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
145 changes: 145 additions & 0 deletions
145
third_party/jformatstring/java/edu/umd/cs/findbugs/formatStringChecker/Conversion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/* | ||
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Sun designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Sun in the LICENSE file that accompanied this code. | ||
* | ||
* This code 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 GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | ||
* CA 95054 USA or visit www.sun.com if you need additional information or | ||
* have any questions. | ||
*/ | ||
/* This file has been extensively modified from the original Sun implementation | ||
* to provide for compile time checking of Format Strings. | ||
* | ||
* These modifications were performed by Bill Pugh, this code is free software. | ||
* | ||
*/ | ||
package edu.umd.cs.findbugs.formatStringChecker; | ||
|
||
class Conversion { | ||
// Byte, Short, Integer, Long, BigInteger | ||
// (and associated primitives due to autoboxing) | ||
static final char DECIMAL_INTEGER = 'd'; | ||
static final char OCTAL_INTEGER = 'o'; | ||
static final char HEXADECIMAL_INTEGER = 'x'; | ||
static final char HEXADECIMAL_INTEGER_UPPER = 'X'; | ||
|
||
// Float, Double, BigDecimal | ||
// (and associated primitives due to autoboxing) | ||
static final char SCIENTIFIC = 'e'; | ||
static final char SCIENTIFIC_UPPER = 'E'; | ||
static final char GENERAL = 'g'; | ||
static final char GENERAL_UPPER = 'G'; | ||
static final char DECIMAL_FLOAT = 'f'; | ||
static final char HEXADECIMAL_FLOAT = 'a'; | ||
static final char HEXADECIMAL_FLOAT_UPPER = 'A'; | ||
|
||
// Character, Byte, Short, Integer | ||
// (and associated primitives due to autoboxing) | ||
static final char CHARACTER = 'c'; | ||
static final char CHARACTER_UPPER = 'C'; | ||
|
||
// java.util.Date, java.util.Calendar, long | ||
static final char DATE_TIME = 't'; | ||
static final char DATE_TIME_UPPER = 'T'; | ||
|
||
// if (arg.TYPE != boolean) return boolean | ||
// if (arg != null) return true; else return false; | ||
static final char BOOLEAN = 'b'; | ||
static final char BOOLEAN_UPPER = 'B'; | ||
// if (arg instanceof Formattable) arg.formatTo() | ||
// else arg.toString(); | ||
static final char STRING = 's'; | ||
static final char STRING_UPPER = 'S'; | ||
// arg.hashCode() | ||
static final char HASHCODE = 'h'; | ||
static final char HASHCODE_UPPER = 'H'; | ||
|
||
static final char LINE_SEPARATOR = 'n'; | ||
static final char PERCENT_SIGN = '%'; | ||
|
||
static boolean isValid(char c) { | ||
return (isGeneral(c) || isInteger(c) || isFloat(c) || isText(c) | ||
|| c == 't' || isCharacter(c)); | ||
} | ||
|
||
// Returns true iff the Conversion is applicable to all objects. | ||
static boolean isGeneral(char c) { | ||
switch (c) { | ||
case BOOLEAN: | ||
case BOOLEAN_UPPER: | ||
case STRING: | ||
case STRING_UPPER: | ||
case HASHCODE: | ||
case HASHCODE_UPPER: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
// Returns true iff the Conversion is applicable to character. | ||
static boolean isCharacter(char c) { | ||
switch (c) { | ||
case CHARACTER: | ||
case CHARACTER_UPPER: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
// Returns true iff the Conversion is an integer type. | ||
static boolean isInteger(char c) { | ||
switch (c) { | ||
case DECIMAL_INTEGER: | ||
case OCTAL_INTEGER: | ||
case HEXADECIMAL_INTEGER: | ||
case HEXADECIMAL_INTEGER_UPPER: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
// Returns true iff the Conversion is a floating-point type. | ||
static boolean isFloat(char c) { | ||
switch (c) { | ||
case SCIENTIFIC: | ||
case SCIENTIFIC_UPPER: | ||
case GENERAL: | ||
case GENERAL_UPPER: | ||
case DECIMAL_FLOAT: | ||
case HEXADECIMAL_FLOAT: | ||
case HEXADECIMAL_FLOAT_UPPER: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
// Returns true iff the Conversion does not require an argument | ||
static boolean isText(char c) { | ||
switch (c) { | ||
case LINE_SEPARATOR: | ||
case PERCENT_SIGN: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
} |
132 changes: 132 additions & 0 deletions
132
third_party/jformatstring/java/edu/umd/cs/findbugs/formatStringChecker/DateTime.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Sun designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Sun in the LICENSE file that accompanied this code. | ||
* | ||
* This code 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 GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | ||
* CA 95054 USA or visit www.sun.com if you need additional information or | ||
* have any questions. | ||
*/ | ||
/* This file has been extensively modified from the original Sun implementation | ||
* to provide for compile time checking of Format Strings. | ||
* | ||
* These modifications were performed by Bill Pugh, this code is free software. | ||
* | ||
*/ | ||
package edu.umd.cs.findbugs.formatStringChecker; | ||
|
||
class DateTime { | ||
static final char HOUR_OF_DAY_0 = 'H'; // (00 - 23) | ||
static final char HOUR_0 = 'I'; // (01 - 12) | ||
static final char HOUR_OF_DAY = 'k'; // (0 - 23) -- like H | ||
static final char HOUR = 'l'; // (1 - 12) -- like I | ||
static final char MINUTE = 'M'; // (00 - 59) | ||
static final char NANOSECOND = 'N'; // (000000000 - 999999999) | ||
static final char MILLISECOND = 'L'; // jdk, not in gnu (000 - 999) | ||
static final char MILLISECOND_SINCE_EPOCH = 'Q'; // (0 - 99...?) | ||
static final char AM_PM = 'p'; // (am or pm) | ||
static final char SECONDS_SINCE_EPOCH = 's'; // (0 - 99...?) | ||
static final char SECOND = 'S'; // (00 - 60 - leap second) | ||
static final char TIME = 'T'; // (24 hour hh:mm:ss) | ||
static final char ZONE_NUMERIC = 'z'; // (-1200 - +1200) - ls minus? | ||
static final char ZONE = 'Z'; // (symbol) | ||
|
||
// Date | ||
static final char NAME_OF_DAY_ABBREV = 'a'; // 'a' | ||
static final char NAME_OF_DAY = 'A'; // 'A' | ||
static final char NAME_OF_MONTH_ABBREV = 'b'; // 'b' | ||
static final char NAME_OF_MONTH = 'B'; // 'B' | ||
static final char CENTURY = 'C'; // (00 - 99) | ||
static final char DAY_OF_MONTH_0 = 'd'; // (01 - 31) | ||
static final char DAY_OF_MONTH = 'e'; // (1 - 31) -- like d | ||
// * static final char ISO_WEEK_OF_YEAR_2 = 'g'; // cross %y %V | ||
// * static final char ISO_WEEK_OF_YEAR_4 = 'G'; // cross %Y %V | ||
static final char NAME_OF_MONTH_ABBREV_X = 'h'; // -- same b | ||
static final char DAY_OF_YEAR = 'j'; // (001 - 366) | ||
static final char MONTH = 'm'; // (01 - 12) | ||
// * static final char DAY_OF_WEEK_1 = 'u'; // (1 - 7) Monday | ||
// * static final char WEEK_OF_YEAR_SUNDAY = 'U'; // (0 - 53) Sunday+ | ||
// * static final char WEEK_OF_YEAR_MONDAY_01 = 'V'; // (01 - 53) Monday+ | ||
// * static final char DAY_OF_WEEK_0 = 'w'; // (0 - 6) Sunday | ||
// * static final char WEEK_OF_YEAR_MONDAY = 'W'; // (00 - 53) Monday | ||
static final char YEAR_2 = 'y'; // (00 - 99) | ||
static final char YEAR_4 = 'Y'; // (0000 - 9999) | ||
|
||
// Composites | ||
static final char TIME_12_HOUR = 'r'; // (hh:mm:ss [AP]M) | ||
static final char TIME_24_HOUR = 'R'; // (hh:mm same as %H:%M) | ||
// * static final char LOCALE_TIME = 'X'; // (%H:%M:%S) - parse format? | ||
static final char DATE_TIME = 'c'; | ||
// (Sat Nov 04 12:02:33 EST 1999) | ||
static final char DATE = 'D'; // (mm/dd/yy) | ||
static final char ISO_STANDARD_DATE = 'F'; // (%Y-%m-%d) | ||
|
||
// * static final char LOCALE_DATE = 'x'; // (mm/dd/yy) | ||
|
||
static boolean isValid(char c) { | ||
switch (c) { | ||
case HOUR_OF_DAY_0: | ||
case HOUR_0: | ||
case HOUR_OF_DAY: | ||
case HOUR: | ||
case MINUTE: | ||
case NANOSECOND: | ||
case MILLISECOND: | ||
case MILLISECOND_SINCE_EPOCH: | ||
case AM_PM: | ||
case SECONDS_SINCE_EPOCH: | ||
case SECOND: | ||
case TIME: | ||
case ZONE_NUMERIC: | ||
case ZONE: | ||
|
||
// Date | ||
case NAME_OF_DAY_ABBREV: | ||
case NAME_OF_DAY: | ||
case NAME_OF_MONTH_ABBREV: | ||
case NAME_OF_MONTH: | ||
case CENTURY: | ||
case DAY_OF_MONTH_0: | ||
case DAY_OF_MONTH: | ||
// * case ISO_WEEK_OF_YEAR_2: | ||
// * case ISO_WEEK_OF_YEAR_4: | ||
case NAME_OF_MONTH_ABBREV_X: | ||
case DAY_OF_YEAR: | ||
case MONTH: | ||
// * case DAY_OF_WEEK_1: | ||
// * case WEEK_OF_YEAR_SUNDAY: | ||
// * case WEEK_OF_YEAR_MONDAY_01: | ||
// * case DAY_OF_WEEK_0: | ||
// * case WEEK_OF_YEAR_MONDAY: | ||
case YEAR_2: | ||
case YEAR_4: | ||
|
||
// Composites | ||
case TIME_12_HOUR: | ||
case TIME_24_HOUR: | ||
// * case LOCALE_TIME: | ||
case DATE_TIME: | ||
case DATE: | ||
case ISO_STANDARD_DATE: | ||
// * case LOCALE_DATE: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
} |
Oops, something went wrong.