|
1 | 1 | /* |
2 | | - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -91,7 +91,7 @@ public static Stream<Arguments> provideLocalClasses() { |
91 | 91 | @MethodSource("provideLocalClasses") |
92 | 92 | public void testLocal(String interfaces, String members) throws Exception { |
93 | 93 | log.printf("interfaces: %s; members: %s%n", interfaces, members); |
94 | | - Path base = getScratchDir().resolve(getDirectory(interfaces, members)); |
| 94 | + Path base = getScratchDir(getSubdirectoryName(interfaces, members)); |
95 | 95 | log.println(base); |
96 | 96 |
|
97 | 97 | Path src = Files.createDirectories(base.resolve("src")); |
@@ -154,16 +154,18 @@ public void testSystemClass(String name) throws Exception { |
154 | 154 | Assertions.assertEquals(platformSerialVersionUID, classSerialVersionUID, "serialVersionUID from class"); |
155 | 155 | } |
156 | 156 |
|
157 | | - Path getDirectory(String interfaces, String members) { |
| 157 | + String getSubdirectoryName(String interfaces, String members) { |
158 | 158 | String i = Stream.of(interfaces.split("\\s+")) |
159 | 159 | .map(s -> s.substring(s.lastIndexOf(".") + 1)) |
160 | 160 | .collect(Collectors.joining("-")); |
161 | | - String m = Stream.of(members.split(";\\s*")) |
162 | | - .map(s -> s.replaceAll("=.*", "")) |
163 | | - .map(s -> s.substring(s.lastIndexOf(" ") + 1)) |
164 | | - .collect(Collectors.joining("-")); |
| 161 | + // allow for all kinds of members: not just fields |
| 162 | + String m = members.replaceAll("[^A-Za-z0-9]+", "-"); |
| 163 | + int MAX_MEMBER_LENGTH = 32; |
| 164 | + if (m.length() > MAX_MEMBER_LENGTH) { |
| 165 | + m = m.substring(0, MAX_MEMBER_LENGTH); |
| 166 | + } |
165 | 167 | String sep = i.isEmpty() || m.isEmpty() ? "" : "-"; |
166 | | - return Path.of(i + sep + m); |
| 168 | + return i + sep + m; |
167 | 169 | } |
168 | 170 |
|
169 | 171 | long getPlatformSerialVersionUID(Path classes, String name) throws Exception { |
|
0 commit comments