From ed79b80660ae0bb51073fd47340c9d91793b02b0 Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Thu, 11 Jul 2019 13:58:20 +0200 Subject: [PATCH 01/17] Added improved exception handling of isValidMapcodeFormat --- README.md | 4 +++ pom.xml | 2 +- src/main/java/com/mapcode/Decoder.java | 10 +++--- src/main/java/com/mapcode/Mapcode.java | 2 ++ .../com/mapcode/UnknownDecodeException.java | 32 +++++++++++++++++++ src/test/java/com/mapcode/DecoderTest.java | 28 ++++++++++++++++ 6 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/mapcode/UnknownDecodeException.java diff --git a/README.md b/README.md index c0dced7..874bc7f 100644 --- a/README.md +++ b/README.md @@ -480,6 +480,10 @@ Normally, one of our developers should be able to comment on them and fix. mat These are the release notes for the Java library for mapcodes. +### 2.4.12 + +* Added unit tests to check internal data structures. + ### 2.4.11 * Fixed a bug in `Mapcode.isValidMapcodeFormat()` which caused an exception when parsing a Unicode mapcode diff --git a/pom.xml b/pom.xml index 8466912..2b251d1 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ mapcode jar - 2.4.11 + 2.4.12 Mapcode Java Library diff --git a/src/main/java/com/mapcode/Decoder.java b/src/main/java/com/mapcode/Decoder.java index f44dc0c..ea03317 100644 --- a/src/main/java/com/mapcode/Decoder.java +++ b/src/main/java/com/mapcode/Decoder.java @@ -205,7 +205,7 @@ static MapcodeZone decodeToMapcodeZone(@Nonnull final String argMapcode, // Private methods. // ---------------------------------------------------------------------- - private final static int[] DECODE_CHARS = { + final static int[] DECODE_CHARS = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -224,7 +224,7 @@ static MapcodeZone decodeToMapcodeZone(@Nonnull final String argMapcode, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - private static class Unicode2Ascii { + static class Unicode2Ascii { final char min; final char max; @@ -245,7 +245,7 @@ private static class Unicode2Ascii { private static final char MISSCODE = '?'; // @formatter:off - @SuppressWarnings("LongLine") private final static char[][] ASCII2LANGUAGE = { + @SuppressWarnings("LongLine") final static char[][] ASCII2LANGUAGE = { // Character: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 /* Roman */ {'\u0041', '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047', '\u0048', '\u0049', '\u004a', '\u004b', '\u004c', '\u004d', '\u004e', '\u004f', '\u0050', '\u0051', '\u0052', '\u0053', '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005a', '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035', '\u0036', '\u0037', '\u0038', '\u0039'}, // Roman /* Greek */ {'\u0391', '\u0392', '\u039e', '\u0394', '\u0388', '\u0395', '\u0393', '\u0397', '\u0399', '\u03a0', '\u039a', '\u039b', '\u039c', '\u039d', '\u039f', '\u03a1', '\u0398', '\u03a8', '\u03a3', '\u03a4', '\u0389', '\u03a6', '\u03a9', '\u03a7', '\u03a5', '\u0396', '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035', '\u0036', '\u0037', '\u0038', '\u0039'}, // Greek @@ -279,7 +279,7 @@ private static class Unicode2Ascii { // @formatter:on // @formatter:off - @SuppressWarnings("LongLine") private final static Unicode2Ascii[] UNICODE2ASCII = { + @SuppressWarnings("LongLine") final static Unicode2Ascii[] UNICODE2ASCII = { /* Roman */ new Unicode2Ascii('\u0041', '\u005a', "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), // Roman /* Greek */ new Unicode2Ascii('\u0388', '\u03a9', "EU???????ABGDFZHQIKLMNCOJP?STYVXRW"), // Greek /* Cyrillic */ new Unicode2Ascii('\u0410', '\u042f', "AZBGDEFNI?KLMHOJPCTYQXSVW????U?R"), // Cyrillic @@ -728,7 +728,7 @@ static String decodeUTF16(@Nonnull final String mapcode) { if (mapcode.startsWith(String.valueOf(GREEK_CAPITAL_ALPHA))) { final String unpacked = aeuUnpack(result); if (unpacked.isEmpty()) { - throw new AssertionError("decodeUTF16: cannot decode " + mapcode); + throw new UnknownDecodeException("decodeUTF16: cannot decode " + mapcode); } result = Encoder.aeuPack(unpacked, false); } diff --git a/src/main/java/com/mapcode/Mapcode.java b/src/main/java/com/mapcode/Mapcode.java index cd41ded..1e83a1b 100644 --- a/src/main/java/com/mapcode/Mapcode.java +++ b/src/main/java/com/mapcode/Mapcode.java @@ -322,6 +322,8 @@ public static boolean isValidMapcodeFormat(@Nullable final String mapcode) throw return true; } catch (final UnknownPrecisionFormatException ignored) { return false; + } catch (final UnknownDecodeException ignored2) { + return false; } } diff --git a/src/main/java/com/mapcode/UnknownDecodeException.java b/src/main/java/com/mapcode/UnknownDecodeException.java new file mode 100644 index 0000000..1c7bb7d --- /dev/null +++ b/src/main/java/com/mapcode/UnknownDecodeException.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.mapcode; + +import javax.annotation.Nonnull; + +/** + * This runtime exception is thrown is decoding fails for an unknown reason. + * The exception is not exposed externally. + */ +final class UnknownDecodeException extends IllegalStateException { + private static final long serialVersionUID = 1L; + + UnknownDecodeException(@Nonnull final String message) { + super(message); + assert message != null; + } +} diff --git a/src/test/java/com/mapcode/DecoderTest.java b/src/test/java/com/mapcode/DecoderTest.java index 14803df..0fc0e08 100644 --- a/src/test/java/com/mapcode/DecoderTest.java +++ b/src/test/java/com/mapcode/DecoderTest.java @@ -16,6 +16,7 @@ package com.mapcode; +import com.mapcode.Decoder.Unicode2Ascii; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,9 +27,36 @@ public class DecoderTest { private static final Logger LOG = LoggerFactory.getLogger(DecoderTest.class); + @Test + public void tableDecodeChars() { + LOG.info("tableDecodeChars"); + assertEquals("Length: " + Decoder.DECODE_CHARS.length, 256, Decoder.DECODE_CHARS.length); + } + + @Test + public void tableAscii2Language() { + LOG.info("tableAscii2Language"); + assertEquals(Decoder.ASCII2LANGUAGE.length, Decoder.UNICODE2ASCII.length - 10 /* Digits */ - 3 /* Lowercase */); + int i = 1; + for (char[] chars : Decoder.ASCII2LANGUAGE) { + assertEquals("At row " + i + ", length: " + chars.length, 36, chars.length); + ++i; + } + } + + @Test + public void tableUnicodeToAscii() { + LOG.info("tableUnicodeToAscii"); + for (Unicode2Ascii unicode2Ascii : Decoder.UNICODE2ASCII) { + assertEquals("Error at: u" + Integer.toHexString(unicode2Ascii.min), + (int) unicode2Ascii.max - (int) unicode2Ascii.min, unicode2Ascii.convert.length() - 1); + } + } + @SuppressWarnings("JUnitTestMethodWithNoAssertions") @Test public void getInternationalGrid() { + LOG.info("getInternationalGrid"); final DataModel dataModel = DataModel.getInstance(); final int world = Territory.AAA.getNumber(); final int to = dataModel.getDataLastRecord(world); From dc7971a7a9ef6b2e695992da5dd711716c4d44cd Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Thu, 18 Jul 2019 10:11:00 +0200 Subject: [PATCH 02/17] Minor code cleanup --- README.md | 4 ++++ pom.xml | 2 +- src/main/java/com/mapcode/Common.java | 1 - src/main/java/com/mapcode/DataModel.java | 2 +- src/main/java/com/mapcode/Encoder.java | 3 +-- src/main/java/com/mapcode/Mapcode.java | 8 ++++---- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 874bc7f..58a6dcf 100644 --- a/README.md +++ b/README.md @@ -480,6 +480,10 @@ Normally, one of our developers should be able to comment on them and fix. mat These are the release notes for the Java library for mapcodes. +### 2.4.13 + +* Minor code cleanup. + ### 2.4.12 * Added unit tests to check internal data structures. diff --git a/pom.xml b/pom.xml index 2b251d1..1e70cb0 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ mapcode jar - 2.4.12 + 2.4.13-SNAPSHOT Mapcode Java Library diff --git a/src/main/java/com/mapcode/Common.java b/src/main/java/com/mapcode/Common.java index c689b7f..7e49222 100644 --- a/src/main/java/com/mapcode/Common.java +++ b/src/main/java/com/mapcode/Common.java @@ -90,7 +90,6 @@ private Common() { // This method returns a divider for longitude (multiplied by 4), for a given latitude. // TODO: Need better names for minY and maxY. - @SuppressWarnings("ConstantConditions") static int xDivider(final int latMin, final int latMax) { assert latMin < latMax; if (latMin >= 0) { diff --git a/src/main/java/com/mapcode/DataModel.java b/src/main/java/com/mapcode/DataModel.java index e1107d2..73741ff 100644 --- a/src/main/java/com/mapcode/DataModel.java +++ b/src/main/java/com/mapcode/DataModel.java @@ -86,7 +86,7 @@ private static int readLongLoHi(final int lo, final int mid1, final int mid2, fi private static final Object mutex = new Object(); @SuppressWarnings({"DoubleCheckedLocking", "SynchronizationOnStaticField"}) - public static DataModel getInstance() { + static DataModel getInstance() { if (instance == null) { synchronized (mutex) { if (instance == null) { diff --git a/src/main/java/com/mapcode/Encoder.java b/src/main/java/com/mapcode/Encoder.java index becff65..e761c21 100644 --- a/src/main/java/com/mapcode/Encoder.java +++ b/src/main/java/com/mapcode/Encoder.java @@ -338,8 +338,7 @@ private static String encodeAutoHeader( if (Data.getTerritoryRecordType(i) == Data.TERRITORY_RECORD_TYPE_PLUS) // plus pipe { final int goodRounder = (codexm >= 23) ? (961 * 961 * 31) : (961 * 961); - product = - ((((storageStart + product + goodRounder) - 1) / goodRounder) * goodRounder) - storageStart; + product = ((((storageStart + product + goodRounder) - 1) / goodRounder) * goodRounder) - storageStart; } if (i == territoryRecord) { diff --git a/src/main/java/com/mapcode/Mapcode.java b/src/main/java/com/mapcode/Mapcode.java index 1e83a1b..77b258e 100644 --- a/src/main/java/com/mapcode/Mapcode.java +++ b/src/main/java/com/mapcode/Mapcode.java @@ -249,13 +249,13 @@ public Territory getTerritory() { * provided as statics to only compile these patterns once. */ @Nonnull - static final String REGEX_TERRITORY = "[\\p{L}\\p{N}]{2,3}+([-_][\\p{L}\\p{N}]{2,3}+)?"; + private static final String REGEX_TERRITORY = "[\\p{L}\\p{N}]{2,3}+([-_][\\p{L}\\p{N}]{2,3}+)?"; @Nonnull - static final String REGEX_CODE_PREFIX = "[\\p{L}\\p{N}]{2,5}+"; + private static final String REGEX_CODE_PREFIX = "[\\p{L}\\p{N}]{2,5}+"; @Nonnull - static final String REGEX_CODE_POSTFIX = "[\\p{L}\\p{N}]{2,4}+"; + private static final String REGEX_CODE_POSTFIX = "[\\p{L}\\p{N}]{2,4}+"; @Nonnull - static final String REGEX_CODE_PRECISION = "[-][\\p{L}\\p{N}&&[^zZ]]{1,8}+"; + private static final String REGEX_CODE_PRECISION = "[-][\\p{L}\\p{N}&&[^zZ]]{1,8}+"; /** * This patterns/regular expressions is used for checking mapcode format strings. From 36f3ae78417ad3781799ada0127fb1feb35e3ded Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Wed, 21 Aug 2019 09:58:33 +0200 Subject: [PATCH 03/17] Changed scope of slf4j --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1e70cb0..cddf11c 100644 --- a/pom.xml +++ b/pom.xml @@ -292,14 +292,12 @@ log4j log4j ${log4j.version} - test org.slf4j slf4j-log4j12 ${slf4j.version} - test From 4d7a8a7efc3a5d3d345772bed35c33a529636df9 Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Tue, 3 Dec 2019 11:33:26 +0100 Subject: [PATCH 04/17] Fixed dependency version --- .idea/.gitignore | 2 ++ pom.xml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/pom.xml b/pom.xml index cddf11c..d43e295 100644 --- a/pom.xml +++ b/pom.xml @@ -84,7 +84,7 @@ 1.6.8 - 2.8.5 + 2.8.6 3.0.2 4.12 1.2.17 From f8e6282d045664e8a4640d66ee6a5b038f2c40a2 Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Tue, 3 Dec 2019 11:48:37 +0100 Subject: [PATCH 05/17] Updated dependency --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d43e295..2d9d399 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ mapcode jar - 2.4.13-SNAPSHOT + 2.4.13 Mapcode Java Library From 9f5ce3eb9be6f66350ef0c16ae8ff98ec07dd750 Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Tue, 21 Apr 2020 11:31:31 +0200 Subject: [PATCH 06/17] Updated version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2d9d399..6238c38 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ mapcode jar - 2.4.13 + 2.4.14-SNAPSHOT Mapcode Java Library From 411ed97d293aa1cec3f24e11fefc9ee91db5fd0d Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Tue, 21 Apr 2020 12:04:54 +0200 Subject: [PATCH 07/17] Updated dependencies --- pom.xml | 46 +++++++++++++------ src/main/java/com/mapcode/Alphabet.java | 4 +- src/main/java/com/mapcode/Boundary.java | 4 +- src/main/java/com/mapcode/CheckArgs.java | 5 +- src/main/java/com/mapcode/Common.java | 4 +- src/main/java/com/mapcode/Data.java | 4 +- src/main/java/com/mapcode/DataModel.java | 4 +- src/main/java/com/mapcode/Decoder.java | 10 +++- src/main/java/com/mapcode/Encoder.java | 4 +- .../mapcode/IncorrectDataModelException.java | 4 +- src/main/java/com/mapcode/Mapcode.java | 4 +- src/main/java/com/mapcode/MapcodeCodec.java | 5 +- src/main/java/com/mapcode/MapcodeZone.java | 4 +- src/main/java/com/mapcode/Point.java | 8 +++- src/main/java/com/mapcode/Rectangle.java | 2 +- src/main/java/com/mapcode/Territory.java | 12 ++--- .../com/mapcode/UnknownAlphabetException.java | 4 +- .../com/mapcode/UnknownDecodeException.java | 4 +- .../com/mapcode/UnknownMapcodeException.java | 4 +- .../UnknownPrecisionFormatException.java | 4 +- .../mapcode/UnknownTerritoryException.java | 4 +- src/test/java/com/mapcode/AlphabetTest.java | 8 ++-- src/test/java/com/mapcode/CheckArgsTest.java | 4 +- src/test/java/com/mapcode/DataModelTest.java | 4 +- src/test/java/com/mapcode/DecoderTest.java | 8 ++-- .../java/com/mapcode/EncodeDecodeTest.java | 4 +- src/test/java/com/mapcode/EncoderTest.java | 4 +- src/test/java/com/mapcode/MapcodeTest.java | 4 +- src/test/java/com/mapcode/PointTest.java | 4 +- .../java/com/mapcode/ReferenceFileTest.java | 4 +- src/test/java/com/mapcode/TerritoryTest.java | 4 +- src/test/resources/log4j.xml | 28 +++++------ src/test/resources/show3d/sketch.properties | 16 +++++++ 33 files changed, 139 insertions(+), 97 deletions(-) diff --git a/pom.xml b/pom.xml index 6238c38..82139b9 100644 --- a/pom.xml +++ b/pom.xml @@ -1,3 +1,19 @@ + + 8) ? 8 : extrapostfix.length(); while (idx < len) { + //noinspection RedundantCast int c1 = (int) extrapostfix.charAt(idx); idx++; c1 = DECODE_CHARS[c1]; @@ -861,6 +865,7 @@ private static MapcodeZone decodeExtension( final int y2; final int x2; if (idx < len) { + //noinspection RedundantCast int c2 = (int) extrapostfix.charAt(idx); idx++; c2 = DECODE_CHARS[c2]; @@ -915,6 +920,7 @@ private static MapcodeZone decodeExtension( private static boolean isAbjadScript(@Nonnull final String argStr) { for (final char ch : argStr.toCharArray()) { + //noinspection RedundantCast final int c = (int) ch; if ((c >= 0x0628) && (c <= 0x0649)) { return true; // Arabic diff --git a/src/main/java/com/mapcode/Encoder.java b/src/main/java/com/mapcode/Encoder.java index e761c21..b644008 100644 --- a/src/main/java/com/mapcode/Encoder.java +++ b/src/main/java/com/mapcode/Encoder.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/main/java/com/mapcode/IncorrectDataModelException.java b/src/main/java/com/mapcode/IncorrectDataModelException.java index f543139..333daf9 100644 --- a/src/main/java/com/mapcode/IncorrectDataModelException.java +++ b/src/main/java/com/mapcode/IncorrectDataModelException.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/main/java/com/mapcode/Mapcode.java b/src/main/java/com/mapcode/Mapcode.java index 77b258e..a9ad857 100644 --- a/src/main/java/com/mapcode/Mapcode.java +++ b/src/main/java/com/mapcode/Mapcode.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/main/java/com/mapcode/MapcodeCodec.java b/src/main/java/com/mapcode/MapcodeCodec.java index ba306d8..f992763 100644 --- a/src/main/java/com/mapcode/MapcodeCodec.java +++ b/src/main/java/com/mapcode/MapcodeCodec.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -416,6 +416,7 @@ public static boolean isNearMultipleBorders(@Nonnull final Point point, @Nonnull return false; } + @SuppressWarnings("OverlyBroadThrowsClause") @Nonnull private static MapcodeZone decodeToMapcodeZone(@Nonnull final String mapcode, @Nullable final Territory defaultTerritoryContext) throws UnknownMapcodeException, IllegalArgumentException { diff --git a/src/main/java/com/mapcode/MapcodeZone.java b/src/main/java/com/mapcode/MapcodeZone.java index a3d9ae4..632ba2f 100644 --- a/src/main/java/com/mapcode/MapcodeZone.java +++ b/src/main/java/com/mapcode/MapcodeZone.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/main/java/com/mapcode/Point.java b/src/main/java/com/mapcode/Point.java index a3a1153..0361bcf 100644 --- a/src/main/java/com/mapcode/Point.java +++ b/src/main/java/com/mapcode/Point.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -36,9 +36,13 @@ public final class Point { // Latitude and longitude ranges. + @SuppressWarnings("unused") public static final double LON_DEG_MIN = -180.0; + @SuppressWarnings("unused") public static final double LON_DEG_MAX = 180.0; + @SuppressWarnings("unused") public static final double LAT_DEG_MIN = -90.0; + @SuppressWarnings("unused") public static final double LAT_DEG_MAX = 90.0; // Conversion constants. diff --git a/src/main/java/com/mapcode/Rectangle.java b/src/main/java/com/mapcode/Rectangle.java index 0d3a2d0..e2be172 100644 --- a/src/main/java/com/mapcode/Rectangle.java +++ b/src/main/java/com/mapcode/Rectangle.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/Territory.java b/src/main/java/com/mapcode/Territory.java index a8b04e3..a9089f2 100644 --- a/src/main/java/com/mapcode/Territory.java +++ b/src/main/java/com/mapcode/Territory.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -978,11 +978,11 @@ public boolean hasSubdivisions() { final Set territoryNumbers = new HashSet(); final Set namesSet = new HashSet(); - for (final Territory territory : Territory.values()) { + for (final Territory territory : values()) { final int territoryNumber = territory.getNumber(); // Check if territory code is within range. - if ((territoryNumber < 0) || (territoryNumber >= Territory.values().length)) { + if ((territoryNumber < 0) || (territoryNumber >= values().length)) { throw new ExceptionInInitializerError(errorPrefix + "territory number out of range: " + territoryNumber); } @@ -1036,12 +1036,12 @@ public boolean hasSubdivisions() { max = Math.max(max, territory.number); assert territory.alphabets.length > 0; } - assert territoryNumbers.size() == Territory.values().length; + assert territoryNumbers.size() == values().length; // Check that territory has at least one alphabet. // Check for missing codes; minimum code must be 0, maximum code must be last code of enum. - if (!((min == 0) && (max == (Territory.values().length - 1)))) { + if (!((min == 0) && (max == (values().length - 1)))) { throw new ExceptionInInitializerError(errorPrefix + "incorrect min/max territory number: " + min + '/' + max); } } diff --git a/src/main/java/com/mapcode/UnknownAlphabetException.java b/src/main/java/com/mapcode/UnknownAlphabetException.java index c37bd86..9db00cd 100644 --- a/src/main/java/com/mapcode/UnknownAlphabetException.java +++ b/src/main/java/com/mapcode/UnknownAlphabetException.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/main/java/com/mapcode/UnknownDecodeException.java b/src/main/java/com/mapcode/UnknownDecodeException.java index 1c7bb7d..7c1d4af 100644 --- a/src/main/java/com/mapcode/UnknownDecodeException.java +++ b/src/main/java/com/mapcode/UnknownDecodeException.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/main/java/com/mapcode/UnknownMapcodeException.java b/src/main/java/com/mapcode/UnknownMapcodeException.java index 59fcc78..ce759be 100644 --- a/src/main/java/com/mapcode/UnknownMapcodeException.java +++ b/src/main/java/com/mapcode/UnknownMapcodeException.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/main/java/com/mapcode/UnknownPrecisionFormatException.java b/src/main/java/com/mapcode/UnknownPrecisionFormatException.java index 4f339ea..5c76398 100644 --- a/src/main/java/com/mapcode/UnknownPrecisionFormatException.java +++ b/src/main/java/com/mapcode/UnknownPrecisionFormatException.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/main/java/com/mapcode/UnknownTerritoryException.java b/src/main/java/com/mapcode/UnknownTerritoryException.java index 2f23223..d1bbf8b 100644 --- a/src/main/java/com/mapcode/UnknownTerritoryException.java +++ b/src/main/java/com/mapcode/UnknownTerritoryException.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/test/java/com/mapcode/AlphabetTest.java b/src/test/java/com/mapcode/AlphabetTest.java index 19fb8af..a4b11e5 100644 --- a/src/test/java/com/mapcode/AlphabetTest.java +++ b/src/test/java/com/mapcode/AlphabetTest.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -103,9 +103,7 @@ public void testConvertToAlphabet() throws Exception { final String codeGreek = Mapcode.convertStringToAlphabet(code, Alphabet.GREEK); LOG.debug("testConvertToAlphabet: code={}, codeGreek={}", code, codeGreek); final String expect = CODE_TEST_PAIRS[i + 1]; - if (!expect.isEmpty()) { - assertEquals(codeGreek, expect); - } + assertEquals(codeGreek, expect); final String codeAscii = Mapcode.convertStringToPlainAscii(codeGreek); LOG.debug("testConvertToAlphabet: code={}, codeGreek={}, codeAscii={}", code, codeGreek, codeAscii); assertEquals(code, codeAscii); diff --git a/src/test/java/com/mapcode/CheckArgsTest.java b/src/test/java/com/mapcode/CheckArgsTest.java index 5a4dd6f..4bfe7fe 100644 --- a/src/test/java/com/mapcode/CheckArgsTest.java +++ b/src/test/java/com/mapcode/CheckArgsTest.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/test/java/com/mapcode/DataModelTest.java b/src/test/java/com/mapcode/DataModelTest.java index 2a35c24..1501ee0 100644 --- a/src/test/java/com/mapcode/DataModelTest.java +++ b/src/test/java/com/mapcode/DataModelTest.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/test/java/com/mapcode/DecoderTest.java b/src/test/java/com/mapcode/DecoderTest.java index 0fc0e08..491318c 100644 --- a/src/test/java/com/mapcode/DecoderTest.java +++ b/src/test/java/com/mapcode/DecoderTest.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -38,7 +38,7 @@ public void tableAscii2Language() { LOG.info("tableAscii2Language"); assertEquals(Decoder.ASCII2LANGUAGE.length, Decoder.UNICODE2ASCII.length - 10 /* Digits */ - 3 /* Lowercase */); int i = 1; - for (char[] chars : Decoder.ASCII2LANGUAGE) { + for (final char[] chars : Decoder.ASCII2LANGUAGE) { assertEquals("At row " + i + ", length: " + chars.length, 36, chars.length); ++i; } @@ -47,7 +47,7 @@ public void tableAscii2Language() { @Test public void tableUnicodeToAscii() { LOG.info("tableUnicodeToAscii"); - for (Unicode2Ascii unicode2Ascii : Decoder.UNICODE2ASCII) { + for (final Unicode2Ascii unicode2Ascii : Decoder.UNICODE2ASCII) { assertEquals("Error at: u" + Integer.toHexString(unicode2Ascii.min), (int) unicode2Ascii.max - (int) unicode2Ascii.min, unicode2Ascii.convert.length() - 1); } diff --git a/src/test/java/com/mapcode/EncodeDecodeTest.java b/src/test/java/com/mapcode/EncodeDecodeTest.java index aef1ba6..b6892eb 100644 --- a/src/test/java/com/mapcode/EncodeDecodeTest.java +++ b/src/test/java/com/mapcode/EncodeDecodeTest.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/test/java/com/mapcode/EncoderTest.java b/src/test/java/com/mapcode/EncoderTest.java index 3316c94..556d17b 100644 --- a/src/test/java/com/mapcode/EncoderTest.java +++ b/src/test/java/com/mapcode/EncoderTest.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/test/java/com/mapcode/MapcodeTest.java b/src/test/java/com/mapcode/MapcodeTest.java index c4c4661..2da85e9 100644 --- a/src/test/java/com/mapcode/MapcodeTest.java +++ b/src/test/java/com/mapcode/MapcodeTest.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/test/java/com/mapcode/PointTest.java b/src/test/java/com/mapcode/PointTest.java index f986dcf..1ec4222 100644 --- a/src/test/java/com/mapcode/PointTest.java +++ b/src/test/java/com/mapcode/PointTest.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/test/java/com/mapcode/ReferenceFileTest.java b/src/test/java/com/mapcode/ReferenceFileTest.java index 3834dcb..411ed3a 100644 --- a/src/test/java/com/mapcode/ReferenceFileTest.java +++ b/src/test/java/com/mapcode/ReferenceFileTest.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/test/java/com/mapcode/TerritoryTest.java b/src/test/java/com/mapcode/TerritoryTest.java index 409a24c..656ad0c 100644 --- a/src/test/java/com/mapcode/TerritoryTest.java +++ b/src/test/java/com/mapcode/TerritoryTest.java @@ -1,11 +1,11 @@ /* - * Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/test/resources/log4j.xml b/src/test/resources/log4j.xml index ff649e1..d723c1c 100644 --- a/src/test/resources/log4j.xml +++ b/src/test/resources/log4j.xml @@ -1,19 +1,19 @@ + ~ Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> diff --git a/src/test/resources/show3d/sketch.properties b/src/test/resources/show3d/sketch.properties index 8630fa2..07aa142 100644 --- a/src/test/resources/show3d/sketch.properties +++ b/src/test/resources/show3d/sketch.properties @@ -1,2 +1,18 @@ +# +# Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + mode.id=processing.mode.java.JavaMode mode=Java From ba1cf8b81b63c8dbb52e75850ac9d21080904564 Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Tue, 21 Apr 2020 12:59:31 +0200 Subject: [PATCH 08/17] Updated README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 58a6dcf..4ceff96 100644 --- a/README.md +++ b/README.md @@ -480,6 +480,10 @@ Normally, one of our developers should be able to comment on them and fix. mat These are the release notes for the Java library for mapcodes. +### 2.4.14 + +* Updated dependencies for security vulnerabilities. + ### 2.4.13 * Minor code cleanup. From 902b1b721497f703fed68f8bbb222ad98f99a6db Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Mon, 19 Apr 2021 10:28:02 +0200 Subject: [PATCH 09/17] Updated copyright --- .idea/.gitignore | 2 -- README.md | 12 ++++++++++-- pom.xml | 6 +++--- src/main/java/com/mapcode/Alphabet.java | 2 +- src/main/java/com/mapcode/Boundary.java | 2 +- src/main/java/com/mapcode/CheckArgs.java | 2 +- src/main/java/com/mapcode/Common.java | 2 +- src/main/java/com/mapcode/Data.java | 2 +- src/main/java/com/mapcode/DataModel.java | 2 +- src/main/java/com/mapcode/Decoder.java | 2 +- src/main/java/com/mapcode/Encoder.java | 2 +- .../com/mapcode/IncorrectDataModelException.java | 2 +- src/main/java/com/mapcode/Mapcode.java | 2 +- src/main/java/com/mapcode/MapcodeCodec.java | 2 +- src/main/java/com/mapcode/MapcodeZone.java | 2 +- src/main/java/com/mapcode/Point.java | 2 +- src/main/java/com/mapcode/Rectangle.java | 2 +- src/main/java/com/mapcode/Territory.java | 9 +++++---- .../java/com/mapcode/UnknownAlphabetException.java | 2 +- .../java/com/mapcode/UnknownDecodeException.java | 2 +- .../java/com/mapcode/UnknownMapcodeException.java | 2 +- .../com/mapcode/UnknownPrecisionFormatException.java | 2 +- .../java/com/mapcode/UnknownTerritoryException.java | 2 +- src/test/java/com/mapcode/AlphabetTest.java | 2 +- src/test/java/com/mapcode/CheckArgsTest.java | 2 +- src/test/java/com/mapcode/DataModelTest.java | 2 +- src/test/java/com/mapcode/DecoderTest.java | 2 +- src/test/java/com/mapcode/EncodeDecodeTest.java | 2 +- src/test/java/com/mapcode/EncoderTest.java | 2 +- src/test/java/com/mapcode/MapcodeTest.java | 2 +- src/test/java/com/mapcode/PointTest.java | 2 +- src/test/java/com/mapcode/ReferenceFileTest.java | 2 +- src/test/java/com/mapcode/TerritoryTest.java | 6 +++--- src/test/resources/log4j.xml | 2 +- src/test/resources/show3d/sketch.properties | 2 +- 35 files changed, 51 insertions(+), 44 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 5c98b42..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Default ignored files -/workspace.xml \ No newline at end of file diff --git a/README.md b/README.md index 4ceff96..5bb3cae 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Release](https://img.shields.io/github/release/mapcode-foundation/mapcode-java.svg?maxAge=3600)](https://github.com/mapcode-foundation/mapcode-java/releases) [![Maven Central](https://img.shields.io/maven-central/v/com.mapcode/mapcode.svg?maxAge=3600)](https://maven-badges.herokuapp.com/maven-central/com.mapcode/mapcode) -**Copyright (C) 2014-2019, Stichting Mapcode Foundation (http://www.mapcode.com)** +**Copyright (C) 2014-2021, Stichting Mapcode Foundation (http://www.mapcode.com)** This Java project contains a library to encode latitude/longitude pairs to mapcodes and to decode mapcodes back to latitude/longitude pairs. @@ -477,9 +477,17 @@ Normally, one of our developers should be able to comment on them and fix. # Release Notes -mat + These are the release notes for the Java library for mapcodes. +### 2.4.15 + +* Removed country code ANT (not used for mapcodes) after JDK 1.8. Fixed unit test for that. + +* Updated Maven dependencies for security vulnerabilities. + +* Updated copyrights. + ### 2.4.14 * Updated dependencies for security vulnerabilities. diff --git a/pom.xml b/pom.xml index 82139b9..b87641c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ 2.8.6 3.0.2 - 4.13 + 4.13.2 1.2.17 1.7.30 diff --git a/src/main/java/com/mapcode/Alphabet.java b/src/main/java/com/mapcode/Alphabet.java index 61492b6..ebdd79d 100644 --- a/src/main/java/com/mapcode/Alphabet.java +++ b/src/main/java/com/mapcode/Alphabet.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/Boundary.java b/src/main/java/com/mapcode/Boundary.java index 29c0c35..4e456ee 100644 --- a/src/main/java/com/mapcode/Boundary.java +++ b/src/main/java/com/mapcode/Boundary.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/CheckArgs.java b/src/main/java/com/mapcode/CheckArgs.java index 4af6fd7..c6a2e84 100644 --- a/src/main/java/com/mapcode/CheckArgs.java +++ b/src/main/java/com/mapcode/CheckArgs.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/Common.java b/src/main/java/com/mapcode/Common.java index 0d23252..499cf45 100644 --- a/src/main/java/com/mapcode/Common.java +++ b/src/main/java/com/mapcode/Common.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/Data.java b/src/main/java/com/mapcode/Data.java index 26d4a50..2eb7e37 100644 --- a/src/main/java/com/mapcode/Data.java +++ b/src/main/java/com/mapcode/Data.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/DataModel.java b/src/main/java/com/mapcode/DataModel.java index 7c3d5af..72a8543 100644 --- a/src/main/java/com/mapcode/DataModel.java +++ b/src/main/java/com/mapcode/DataModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/Decoder.java b/src/main/java/com/mapcode/Decoder.java index 6ad8329..195ad2e 100644 --- a/src/main/java/com/mapcode/Decoder.java +++ b/src/main/java/com/mapcode/Decoder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/Encoder.java b/src/main/java/com/mapcode/Encoder.java index b644008..8f2f459 100644 --- a/src/main/java/com/mapcode/Encoder.java +++ b/src/main/java/com/mapcode/Encoder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/IncorrectDataModelException.java b/src/main/java/com/mapcode/IncorrectDataModelException.java index 333daf9..dd7f410 100644 --- a/src/main/java/com/mapcode/IncorrectDataModelException.java +++ b/src/main/java/com/mapcode/IncorrectDataModelException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/Mapcode.java b/src/main/java/com/mapcode/Mapcode.java index a9ad857..e32a310 100644 --- a/src/main/java/com/mapcode/Mapcode.java +++ b/src/main/java/com/mapcode/Mapcode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/MapcodeCodec.java b/src/main/java/com/mapcode/MapcodeCodec.java index f992763..b0e3405 100644 --- a/src/main/java/com/mapcode/MapcodeCodec.java +++ b/src/main/java/com/mapcode/MapcodeCodec.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/MapcodeZone.java b/src/main/java/com/mapcode/MapcodeZone.java index 632ba2f..29300c4 100644 --- a/src/main/java/com/mapcode/MapcodeZone.java +++ b/src/main/java/com/mapcode/MapcodeZone.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/Point.java b/src/main/java/com/mapcode/Point.java index 0361bcf..7544446 100644 --- a/src/main/java/com/mapcode/Point.java +++ b/src/main/java/com/mapcode/Point.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/Rectangle.java b/src/main/java/com/mapcode/Rectangle.java index e2be172..4eebac9 100644 --- a/src/main/java/com/mapcode/Rectangle.java +++ b/src/main/java/com/mapcode/Rectangle.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/Territory.java b/src/main/java/com/mapcode/Territory.java index a9089f2..ed87378 100644 --- a/src/main/java/com/mapcode/Territory.java +++ b/src/main/java/com/mapcode/Territory.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -960,14 +960,15 @@ public boolean hasSubdivisions() { // Add Clipperton Island (not recognized by Java). MAP_ISO3_TO_ISO2.put("CPT", "CP"); + // Remove Antilles (present in Java 1.8, removed later). + MAP_ISO3_TO_ISO2.remove("ANT"); + // Create fixed sets of the keys and values. COUNTRY_ISO2_CODES = new HashSet(MAP_ISO3_TO_ISO2.values()); COUNTRY_ISO3_CODES = new HashSet(MAP_ISO3_TO_ISO2.keySet()); } - /** - * Static checking of the static data structures. - */ + // Static checking of the static data structures. static { final String errorPrefix = "Initializing error: "; CODE_LIST = new ArrayList(); diff --git a/src/main/java/com/mapcode/UnknownAlphabetException.java b/src/main/java/com/mapcode/UnknownAlphabetException.java index 9db00cd..0519e78 100644 --- a/src/main/java/com/mapcode/UnknownAlphabetException.java +++ b/src/main/java/com/mapcode/UnknownAlphabetException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/UnknownDecodeException.java b/src/main/java/com/mapcode/UnknownDecodeException.java index 7c1d4af..ef38c63 100644 --- a/src/main/java/com/mapcode/UnknownDecodeException.java +++ b/src/main/java/com/mapcode/UnknownDecodeException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/UnknownMapcodeException.java b/src/main/java/com/mapcode/UnknownMapcodeException.java index ce759be..2bd7a24 100644 --- a/src/main/java/com/mapcode/UnknownMapcodeException.java +++ b/src/main/java/com/mapcode/UnknownMapcodeException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/UnknownPrecisionFormatException.java b/src/main/java/com/mapcode/UnknownPrecisionFormatException.java index 5c76398..732610e 100644 --- a/src/main/java/com/mapcode/UnknownPrecisionFormatException.java +++ b/src/main/java/com/mapcode/UnknownPrecisionFormatException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/com/mapcode/UnknownTerritoryException.java b/src/main/java/com/mapcode/UnknownTerritoryException.java index d1bbf8b..d2d38b8 100644 --- a/src/main/java/com/mapcode/UnknownTerritoryException.java +++ b/src/main/java/com/mapcode/UnknownTerritoryException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/mapcode/AlphabetTest.java b/src/test/java/com/mapcode/AlphabetTest.java index a4b11e5..47b4c98 100644 --- a/src/test/java/com/mapcode/AlphabetTest.java +++ b/src/test/java/com/mapcode/AlphabetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/mapcode/CheckArgsTest.java b/src/test/java/com/mapcode/CheckArgsTest.java index 4bfe7fe..eb42f78 100644 --- a/src/test/java/com/mapcode/CheckArgsTest.java +++ b/src/test/java/com/mapcode/CheckArgsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/mapcode/DataModelTest.java b/src/test/java/com/mapcode/DataModelTest.java index 1501ee0..358e166 100644 --- a/src/test/java/com/mapcode/DataModelTest.java +++ b/src/test/java/com/mapcode/DataModelTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/mapcode/DecoderTest.java b/src/test/java/com/mapcode/DecoderTest.java index 491318c..213ad00 100644 --- a/src/test/java/com/mapcode/DecoderTest.java +++ b/src/test/java/com/mapcode/DecoderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/mapcode/EncodeDecodeTest.java b/src/test/java/com/mapcode/EncodeDecodeTest.java index b6892eb..a0e4f1a 100644 --- a/src/test/java/com/mapcode/EncodeDecodeTest.java +++ b/src/test/java/com/mapcode/EncodeDecodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/mapcode/EncoderTest.java b/src/test/java/com/mapcode/EncoderTest.java index 556d17b..e1ac239 100644 --- a/src/test/java/com/mapcode/EncoderTest.java +++ b/src/test/java/com/mapcode/EncoderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/mapcode/MapcodeTest.java b/src/test/java/com/mapcode/MapcodeTest.java index 2da85e9..c8b0db2 100644 --- a/src/test/java/com/mapcode/MapcodeTest.java +++ b/src/test/java/com/mapcode/MapcodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/mapcode/PointTest.java b/src/test/java/com/mapcode/PointTest.java index 1ec4222..1ca5d6c 100644 --- a/src/test/java/com/mapcode/PointTest.java +++ b/src/test/java/com/mapcode/PointTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/mapcode/ReferenceFileTest.java b/src/test/java/com/mapcode/ReferenceFileTest.java index 411ed3a..0d9a8dc 100644 --- a/src/test/java/com/mapcode/ReferenceFileTest.java +++ b/src/test/java/com/mapcode/ReferenceFileTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/mapcode/TerritoryTest.java b/src/test/java/com/mapcode/TerritoryTest.java index 656ad0c..b0c23fc 100644 --- a/src/test/java/com/mapcode/TerritoryTest.java +++ b/src/test/java/com/mapcode/TerritoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2020, Stichting Mapcode Foundation (http://www.mapcode.com) + * Copyright (C) 2016-2021, Stichting Mapcode Foundation (http://www.mapcode.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -307,7 +307,7 @@ public void testGetCountryISO2Codes() { LOG.info("testGetCountryISO2Codes"); final Set countryISO2Codes = Territory.allCountryISO2Codes(); LOG.info("set={}", countryISO2Codes); - assertEquals(251, countryISO2Codes.size()); + assertEquals(250, countryISO2Codes.size()); assertEquals(2, countryISO2Codes.iterator().next().length()); } @@ -316,7 +316,7 @@ public void testGetCountryISO3Codes() { LOG.info("testGetCountryISO3Codes"); final Set countryISO3Codes = Territory.allCountryISO3Codes(); LOG.info("set={}", countryISO3Codes); - assertEquals(251, countryISO3Codes.size()); + assertEquals(250, countryISO3Codes.size()); assertEquals(3, countryISO3Codes.iterator().next().length()); } } diff --git a/src/test/resources/log4j.xml b/src/test/resources/log4j.xml index d723c1c..26da1c8 100644 --- a/src/test/resources/log4j.xml +++ b/src/test/resources/log4j.xml @@ -1,6 +1,6 @@ - 2.8.6 + 2.8.9 3.0.2 4.13.2 - 1.2.17 + 2.17.0 1.7.30 @@ -299,8 +299,14 @@ - log4j - log4j + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + + org.apache.logging.log4j + log4j-core ${log4j.version} From 8859e6d77d4995bd9f3dfd81c092db408637396e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Jan 2022 16:59:08 +0000 Subject: [PATCH 11/17] Bump log4j-core from 2.17.0 to 2.17.1 Bumps log4j-core from 2.17.0 to 2.17.1. --- updated-dependencies: - dependency-name: org.apache.logging.log4j:log4j-core dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d6ecf1e..721c5fb 100644 --- a/pom.xml +++ b/pom.xml @@ -103,7 +103,7 @@ 2.8.9 3.0.2 4.13.2 - 2.17.0 + 2.17.1 1.7.30 From a6b3231c34b8bf673267ff94f8cdcadc564c17b1 Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Thu, 6 Jan 2022 09:17:35 +0100 Subject: [PATCH 12/17] Updated dependencies --- README.md | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1a0fbe6..d5edb54 100644 --- a/README.md +++ b/README.md @@ -480,7 +480,7 @@ Normally, one of our developers should be able to comment on them and fix. These are the release notes for the Java library for mapcodes. -### 2.4.16 +### 2.4.16-2.4.17 * Updated `log4j` and `gson` dependencies. diff --git a/pom.xml b/pom.xml index 721c5fb..f408783 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ mapcode jar - 2.4.16 + 2.4.17 Mapcode Java Library From 5bbd82abe8c398f5fa5435a67af7f349ebeb3347 Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Mon, 25 Apr 2022 15:29:02 +0200 Subject: [PATCH 13/17] Updated dependencies --- README.md | 2 +- pom.xml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d5edb54..f2eb1e9 100644 --- a/README.md +++ b/README.md @@ -480,7 +480,7 @@ Normally, one of our developers should be able to comment on them and fix. These are the release notes for the Java library for mapcodes. -### 2.4.16-2.4.17 +### 2.4.16-2.4.18 * Updated `log4j` and `gson` dependencies. diff --git a/pom.xml b/pom.xml index f408783..a6e4299 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ mapcode jar - 2.4.17 + 2.4.18 Mapcode Java Library @@ -100,11 +100,11 @@ 1.6.8 - 2.8.9 + 2.9.0 3.0.2 4.13.2 - 2.17.1 - 1.7.30 + 2.17.2 + 1.7.36 From 035efaf7dba779e6bb0a18cfabb9eecd94d99c8f Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Wed, 27 May 2026 11:31:23 +0200 Subject: [PATCH 14/17] fix: added ISO synonyms for Macao and Mexico DIF --- .gitignore | 1 + AGENTS.md | 101 +++++++++++++++++++++++ CLAUDE.md | 101 +++++++++++++++++++++++ README.md | 5 ++ pom.xml | 6 +- src/main/java/com/mapcode/Territory.java | 4 +- 6 files changed, 213 insertions(+), 5 deletions(-) create mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/.gitignore b/.gitignore index 19ba0e5..bd7e011 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ target/ out/ *.versionsBackup +.gitnexus diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..e847df7 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,101 @@ + +# GitNexus — Code Intelligence + +This project is indexed by GitNexus as **mapcode-java** (763 symbols, 2369 relationships, 66 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. + +> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. + +## Always Do + +- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `gitnexus_impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user. +- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows. +- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits. +- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance. +- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`. + +## When Debugging + +1. `gitnexus_query({query: ""})` — find execution flows related to the issue +2. `gitnexus_context({name: ""})` — see all callers, callees, and process participation +3. `READ gitnexus://repo/mapcode-java/process/{processName}` — trace the full execution flow step by step +4. For regressions: `gitnexus_detect_changes({scope: "compare", base_ref: "main"})` — see what your branch changed + +## When Refactoring + +- **Renaming**: MUST use `gitnexus_rename({symbol_name: "old", new_name: "new", dry_run: true})` first. Review the preview — graph edits are safe, text_search edits need manual review. Then run with `dry_run: false`. +- **Extracting/Splitting**: MUST run `gitnexus_context({name: "target"})` to see all incoming/outgoing refs, then `gitnexus_impact({target: "target", direction: "upstream"})` to find all external callers before moving code. +- After any refactor: run `gitnexus_detect_changes({scope: "all"})` to verify only expected files changed. + +## Never Do + +- NEVER edit a function, class, or method without first running `gitnexus_impact` on it. +- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis. +- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph. +- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope. + +## Tools Quick Reference + +| Tool | When to use | Command | +|------|-------------|---------| +| `query` | Find code by concept | `gitnexus_query({query: "auth validation"})` | +| `context` | 360-degree view of one symbol | `gitnexus_context({name: "validateUser"})` | +| `impact` | Blast radius before editing | `gitnexus_impact({target: "X", direction: "upstream"})` | +| `detect_changes` | Pre-commit scope check | `gitnexus_detect_changes({scope: "staged"})` | +| `rename` | Safe multi-file rename | `gitnexus_rename({symbol_name: "old", new_name: "new", dry_run: true})` | +| `cypher` | Custom graph queries | `gitnexus_cypher({query: "MATCH ..."})` | + +## Impact Risk Levels + +| Depth | Meaning | Action | +|-------|---------|--------| +| d=1 | WILL BREAK — direct callers/importers | MUST update these | +| d=2 | LIKELY AFFECTED — indirect deps | Should test | +| d=3 | MAY NEED TESTING — transitive | Test if critical path | + +## Resources + +| Resource | Use for | +|----------|---------| +| `gitnexus://repo/mapcode-java/context` | Codebase overview, check index freshness | +| `gitnexus://repo/mapcode-java/clusters` | All functional areas | +| `gitnexus://repo/mapcode-java/processes` | All execution flows | +| `gitnexus://repo/mapcode-java/process/{name}` | Step-by-step execution trace | + +## Self-Check Before Finishing + +Before completing any code modification task, verify: +1. `gitnexus_impact` was run for all modified symbols +2. No HIGH/CRITICAL risk warnings were ignored +3. `gitnexus_detect_changes()` confirms changes match expected scope +4. All d=1 (WILL BREAK) dependents were updated + +## Keeping the Index Fresh + +After committing code changes, the GitNexus index becomes stale. Re-run analyze to update it: + +```bash +npx gitnexus analyze +``` + +If the index previously included embeddings, preserve them by adding `--embeddings`: + +```bash +npx gitnexus analyze --embeddings +``` + +To check whether embeddings exist, inspect `.gitnexus/meta.json` — the `stats.embeddings` field shows the count (0 means no embeddings). **Running analyze without `--embeddings` will delete any previously generated embeddings.** + +> Claude Code users: A PostToolUse hook handles this automatically after `git commit` and `git merge`. + +## CLI + +| Task | Read this skill file | +|------|---------------------| +| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` | +| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` | +| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` | +| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` | +| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` | +| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` | + + \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..e847df7 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,101 @@ + +# GitNexus — Code Intelligence + +This project is indexed by GitNexus as **mapcode-java** (763 symbols, 2369 relationships, 66 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. + +> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. + +## Always Do + +- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `gitnexus_impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user. +- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows. +- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits. +- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance. +- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`. + +## When Debugging + +1. `gitnexus_query({query: ""})` — find execution flows related to the issue +2. `gitnexus_context({name: ""})` — see all callers, callees, and process participation +3. `READ gitnexus://repo/mapcode-java/process/{processName}` — trace the full execution flow step by step +4. For regressions: `gitnexus_detect_changes({scope: "compare", base_ref: "main"})` — see what your branch changed + +## When Refactoring + +- **Renaming**: MUST use `gitnexus_rename({symbol_name: "old", new_name: "new", dry_run: true})` first. Review the preview — graph edits are safe, text_search edits need manual review. Then run with `dry_run: false`. +- **Extracting/Splitting**: MUST run `gitnexus_context({name: "target"})` to see all incoming/outgoing refs, then `gitnexus_impact({target: "target", direction: "upstream"})` to find all external callers before moving code. +- After any refactor: run `gitnexus_detect_changes({scope: "all"})` to verify only expected files changed. + +## Never Do + +- NEVER edit a function, class, or method without first running `gitnexus_impact` on it. +- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis. +- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph. +- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope. + +## Tools Quick Reference + +| Tool | When to use | Command | +|------|-------------|---------| +| `query` | Find code by concept | `gitnexus_query({query: "auth validation"})` | +| `context` | 360-degree view of one symbol | `gitnexus_context({name: "validateUser"})` | +| `impact` | Blast radius before editing | `gitnexus_impact({target: "X", direction: "upstream"})` | +| `detect_changes` | Pre-commit scope check | `gitnexus_detect_changes({scope: "staged"})` | +| `rename` | Safe multi-file rename | `gitnexus_rename({symbol_name: "old", new_name: "new", dry_run: true})` | +| `cypher` | Custom graph queries | `gitnexus_cypher({query: "MATCH ..."})` | + +## Impact Risk Levels + +| Depth | Meaning | Action | +|-------|---------|--------| +| d=1 | WILL BREAK — direct callers/importers | MUST update these | +| d=2 | LIKELY AFFECTED — indirect deps | Should test | +| d=3 | MAY NEED TESTING — transitive | Test if critical path | + +## Resources + +| Resource | Use for | +|----------|---------| +| `gitnexus://repo/mapcode-java/context` | Codebase overview, check index freshness | +| `gitnexus://repo/mapcode-java/clusters` | All functional areas | +| `gitnexus://repo/mapcode-java/processes` | All execution flows | +| `gitnexus://repo/mapcode-java/process/{name}` | Step-by-step execution trace | + +## Self-Check Before Finishing + +Before completing any code modification task, verify: +1. `gitnexus_impact` was run for all modified symbols +2. No HIGH/CRITICAL risk warnings were ignored +3. `gitnexus_detect_changes()` confirms changes match expected scope +4. All d=1 (WILL BREAK) dependents were updated + +## Keeping the Index Fresh + +After committing code changes, the GitNexus index becomes stale. Re-run analyze to update it: + +```bash +npx gitnexus analyze +``` + +If the index previously included embeddings, preserve them by adding `--embeddings`: + +```bash +npx gitnexus analyze --embeddings +``` + +To check whether embeddings exist, inspect `.gitnexus/meta.json` — the `stats.embeddings` field shows the count (0 means no embeddings). **Running analyze without `--embeddings` will delete any previously generated embeddings.** + +> Claude Code users: A PostToolUse hook handles this automatically after `git commit` and `git merge`. + +## CLI + +| Task | Read this skill file | +|------|---------------------| +| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` | +| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` | +| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` | +| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` | +| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` | +| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` | + + \ No newline at end of file diff --git a/README.md b/README.md index f2eb1e9..38b10c3 100644 --- a/README.md +++ b/README.md @@ -480,6 +480,11 @@ Normally, one of our developers should be able to comment on them and fix. These are the release notes for the Java library for mapcodes. +### 2.4.19 + +* Added synonyms for territories Maco CN-MO and Mexico MX-CMX. +* Updated dependencies. + ### 2.4.16-2.4.18 * Updated `log4j` and `gson` dependencies. diff --git a/pom.xml b/pom.xml index a6e4299..c3ac11d 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ mapcode jar - 2.4.18 + 2.4.19 Mapcode Java Library @@ -100,10 +100,10 @@ 1.6.8 - 2.9.0 + 2.14.0 3.0.2 4.13.2 - 2.17.2 + 2.26.0 1.7.36 diff --git a/src/main/java/com/mapcode/Territory.java b/src/main/java/com/mapcode/Territory.java index ed87378..5f4879f 100644 --- a/src/main/java/com/mapcode/Territory.java +++ b/src/main/java/com/mapcode/Territory.java @@ -48,7 +48,7 @@ public enum Territory { BLM(5, "Saint-Barthelemy"), NRU(6, "Nauru"), TUV(7, "Tuvalu"), - MAC(8, "Macau", new Alphabet[]{Alphabet.CHINESE, Alphabet.ROMAN}, null, new String[]{"CN-92", "CHN-92", "CN-MC", "CHN-MC"}, new String[]{"Aomen"}), + MAC(8, "Macau", new Alphabet[]{Alphabet.CHINESE, Alphabet.ROMAN}, null, new String[]{"CN-92", "CHN-92", "CN-MC", "CHN-MC", "CN-MO", "CHN-MO"}, new String[]{"Aomen"}), SXM(9, "Sint Maarten"), MAF(10, "Saint-Martin"), NFK(11, "Norfolk and Philip Island", null, null, new String[]{"AU-NF", "AUS-NF"}, @@ -277,7 +277,7 @@ public enum Territory { LBY(230, "Libya", new Alphabet[]{Alphabet.ARABIC, Alphabet.ROMAN, Alphabet.TIFINAGH}), SDN(231, "Sudan", new Alphabet[]{Alphabet.ARABIC, Alphabet.ROMAN}), IDN(232, "Indonesia"), - MX_DIF(233, "Federal District", null, MEX, new String[]{"MX-DF"}), + MX_DIF(233, "Federal District", null, MEX, new String[]{"MX-DF", "MX-CMX"}), MX_TLA(234, "Tlaxcala", null, MEX, new String[]{"MX-TL"}), MX_MOR(235, "Morelos", null, MEX, new String[]{"MX-MO"}), MX_AGU(236, "Aguascalientes", null, MEX, new String[]{"MX-AG"}), From 2b92b4b8a20e6f6b910b05d4d0aace7623cd8bf1 Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Wed, 27 May 2026 11:35:58 +0200 Subject: [PATCH 15/17] update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 38b10c3..04fb346 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,11 @@ # Mapcode Library for Java -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0c9f11645f504b50bd154a80fb95a5c3)](https://www.codacy.com/app/rijnb/mapcode-java?utm_source=github.com&utm_medium=referral&utm_content=mapcode-foundation/mapcode-java&utm_campaign=Badge_Grade) -[![Build Status](https://img.shields.io/travis/mapcode-foundation/mapcode-java.svg?maxAge=3600&branch=master)](https://travis-ci.org/mapcode-foundation/mapcode-java) [![Coverage Status](https://coveralls.io/repos/github/mapcode-foundation/mapcode-java/badge.svg?branch=master&maxAge=3600)](https://coveralls.io/github/mapcode-foundation/mapcode-java?branch=master) [![License](http://img.shields.io/badge/license-APACHE2-blue.svg)]() [![Release](https://img.shields.io/github/release/mapcode-foundation/mapcode-java.svg?maxAge=3600)](https://github.com/mapcode-foundation/mapcode-java/releases) [![Maven Central](https://img.shields.io/maven-central/v/com.mapcode/mapcode.svg?maxAge=3600)](https://maven-badges.herokuapp.com/maven-central/com.mapcode/mapcode) -**Copyright (C) 2014-2021, Stichting Mapcode Foundation (http://www.mapcode.com)** +**Copyright (C) 2014-2026, Stichting Mapcode Foundation (http://www.mapcode.com)** This Java project contains a library to encode latitude/longitude pairs to mapcodes and to decode mapcodes back to latitude/longitude pairs. From 9779f2675049888937a95fee31c7b7257f27abd4 Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Wed, 27 May 2026 12:46:22 +0200 Subject: [PATCH 16/17] updated publishing --- pom.xml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index c3ac11d..a2b93fc 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ 3.9.0 3.2.1 2.22.2 - 1.6.8 + 0.8.0 2.14.0 @@ -107,13 +107,6 @@ 1.7.36 - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - @@ -215,16 +208,15 @@ - + - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} + org.sonatype.central + central-publishing-maven-plugin + ${central-publishing-maven-plugin.version} true - ossrh - https://oss.sonatype.org/ - false + central + false From 0df64de6d05a7f8d11f73f8f8449ecf99a6573eb Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Tue, 2 Jun 2026 13:16:38 +0200 Subject: [PATCH 17/17] remove agent files --- AGENTS.md | 101 ------------------------------------------------------ CLAUDE.md | 101 ------------------------------------------------------ 2 files changed, 202 deletions(-) delete mode 100644 AGENTS.md delete mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index e847df7..0000000 --- a/AGENTS.md +++ /dev/null @@ -1,101 +0,0 @@ - -# GitNexus — Code Intelligence - -This project is indexed by GitNexus as **mapcode-java** (763 symbols, 2369 relationships, 66 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. - -> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. - -## Always Do - -- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `gitnexus_impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user. -- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows. -- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits. -- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance. -- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`. - -## When Debugging - -1. `gitnexus_query({query: ""})` — find execution flows related to the issue -2. `gitnexus_context({name: ""})` — see all callers, callees, and process participation -3. `READ gitnexus://repo/mapcode-java/process/{processName}` — trace the full execution flow step by step -4. For regressions: `gitnexus_detect_changes({scope: "compare", base_ref: "main"})` — see what your branch changed - -## When Refactoring - -- **Renaming**: MUST use `gitnexus_rename({symbol_name: "old", new_name: "new", dry_run: true})` first. Review the preview — graph edits are safe, text_search edits need manual review. Then run with `dry_run: false`. -- **Extracting/Splitting**: MUST run `gitnexus_context({name: "target"})` to see all incoming/outgoing refs, then `gitnexus_impact({target: "target", direction: "upstream"})` to find all external callers before moving code. -- After any refactor: run `gitnexus_detect_changes({scope: "all"})` to verify only expected files changed. - -## Never Do - -- NEVER edit a function, class, or method without first running `gitnexus_impact` on it. -- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis. -- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph. -- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope. - -## Tools Quick Reference - -| Tool | When to use | Command | -|------|-------------|---------| -| `query` | Find code by concept | `gitnexus_query({query: "auth validation"})` | -| `context` | 360-degree view of one symbol | `gitnexus_context({name: "validateUser"})` | -| `impact` | Blast radius before editing | `gitnexus_impact({target: "X", direction: "upstream"})` | -| `detect_changes` | Pre-commit scope check | `gitnexus_detect_changes({scope: "staged"})` | -| `rename` | Safe multi-file rename | `gitnexus_rename({symbol_name: "old", new_name: "new", dry_run: true})` | -| `cypher` | Custom graph queries | `gitnexus_cypher({query: "MATCH ..."})` | - -## Impact Risk Levels - -| Depth | Meaning | Action | -|-------|---------|--------| -| d=1 | WILL BREAK — direct callers/importers | MUST update these | -| d=2 | LIKELY AFFECTED — indirect deps | Should test | -| d=3 | MAY NEED TESTING — transitive | Test if critical path | - -## Resources - -| Resource | Use for | -|----------|---------| -| `gitnexus://repo/mapcode-java/context` | Codebase overview, check index freshness | -| `gitnexus://repo/mapcode-java/clusters` | All functional areas | -| `gitnexus://repo/mapcode-java/processes` | All execution flows | -| `gitnexus://repo/mapcode-java/process/{name}` | Step-by-step execution trace | - -## Self-Check Before Finishing - -Before completing any code modification task, verify: -1. `gitnexus_impact` was run for all modified symbols -2. No HIGH/CRITICAL risk warnings were ignored -3. `gitnexus_detect_changes()` confirms changes match expected scope -4. All d=1 (WILL BREAK) dependents were updated - -## Keeping the Index Fresh - -After committing code changes, the GitNexus index becomes stale. Re-run analyze to update it: - -```bash -npx gitnexus analyze -``` - -If the index previously included embeddings, preserve them by adding `--embeddings`: - -```bash -npx gitnexus analyze --embeddings -``` - -To check whether embeddings exist, inspect `.gitnexus/meta.json` — the `stats.embeddings` field shows the count (0 means no embeddings). **Running analyze without `--embeddings` will delete any previously generated embeddings.** - -> Claude Code users: A PostToolUse hook handles this automatically after `git commit` and `git merge`. - -## CLI - -| Task | Read this skill file | -|------|---------------------| -| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` | -| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` | -| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` | -| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` | -| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` | -| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` | - - \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index e847df7..0000000 --- a/CLAUDE.md +++ /dev/null @@ -1,101 +0,0 @@ - -# GitNexus — Code Intelligence - -This project is indexed by GitNexus as **mapcode-java** (763 symbols, 2369 relationships, 66 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. - -> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. - -## Always Do - -- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `gitnexus_impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user. -- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows. -- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits. -- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance. -- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`. - -## When Debugging - -1. `gitnexus_query({query: ""})` — find execution flows related to the issue -2. `gitnexus_context({name: ""})` — see all callers, callees, and process participation -3. `READ gitnexus://repo/mapcode-java/process/{processName}` — trace the full execution flow step by step -4. For regressions: `gitnexus_detect_changes({scope: "compare", base_ref: "main"})` — see what your branch changed - -## When Refactoring - -- **Renaming**: MUST use `gitnexus_rename({symbol_name: "old", new_name: "new", dry_run: true})` first. Review the preview — graph edits are safe, text_search edits need manual review. Then run with `dry_run: false`. -- **Extracting/Splitting**: MUST run `gitnexus_context({name: "target"})` to see all incoming/outgoing refs, then `gitnexus_impact({target: "target", direction: "upstream"})` to find all external callers before moving code. -- After any refactor: run `gitnexus_detect_changes({scope: "all"})` to verify only expected files changed. - -## Never Do - -- NEVER edit a function, class, or method without first running `gitnexus_impact` on it. -- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis. -- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph. -- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope. - -## Tools Quick Reference - -| Tool | When to use | Command | -|------|-------------|---------| -| `query` | Find code by concept | `gitnexus_query({query: "auth validation"})` | -| `context` | 360-degree view of one symbol | `gitnexus_context({name: "validateUser"})` | -| `impact` | Blast radius before editing | `gitnexus_impact({target: "X", direction: "upstream"})` | -| `detect_changes` | Pre-commit scope check | `gitnexus_detect_changes({scope: "staged"})` | -| `rename` | Safe multi-file rename | `gitnexus_rename({symbol_name: "old", new_name: "new", dry_run: true})` | -| `cypher` | Custom graph queries | `gitnexus_cypher({query: "MATCH ..."})` | - -## Impact Risk Levels - -| Depth | Meaning | Action | -|-------|---------|--------| -| d=1 | WILL BREAK — direct callers/importers | MUST update these | -| d=2 | LIKELY AFFECTED — indirect deps | Should test | -| d=3 | MAY NEED TESTING — transitive | Test if critical path | - -## Resources - -| Resource | Use for | -|----------|---------| -| `gitnexus://repo/mapcode-java/context` | Codebase overview, check index freshness | -| `gitnexus://repo/mapcode-java/clusters` | All functional areas | -| `gitnexus://repo/mapcode-java/processes` | All execution flows | -| `gitnexus://repo/mapcode-java/process/{name}` | Step-by-step execution trace | - -## Self-Check Before Finishing - -Before completing any code modification task, verify: -1. `gitnexus_impact` was run for all modified symbols -2. No HIGH/CRITICAL risk warnings were ignored -3. `gitnexus_detect_changes()` confirms changes match expected scope -4. All d=1 (WILL BREAK) dependents were updated - -## Keeping the Index Fresh - -After committing code changes, the GitNexus index becomes stale. Re-run analyze to update it: - -```bash -npx gitnexus analyze -``` - -If the index previously included embeddings, preserve them by adding `--embeddings`: - -```bash -npx gitnexus analyze --embeddings -``` - -To check whether embeddings exist, inspect `.gitnexus/meta.json` — the `stats.embeddings` field shows the count (0 means no embeddings). **Running analyze without `--embeddings` will delete any previously generated embeddings.** - -> Claude Code users: A PostToolUse hook handles this automatically after `git commit` and `git merge`. - -## CLI - -| Task | Read this skill file | -|------|---------------------| -| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` | -| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` | -| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` | -| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` | -| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` | -| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` | - - \ No newline at end of file