1 /* |
1 /* |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
126 (byte) 0xE0, (byte) 0x53, (byte) 0xF3, (byte) 0x13, |
126 (byte) 0xE0, (byte) 0x53, (byte) 0xF3, (byte) 0x13, |
127 (byte) 0x4E, (byte) 0xCF, (byte) 0x49, (byte) 0x32, |
127 (byte) 0x4E, (byte) 0xCF, (byte) 0x49, (byte) 0x32, |
128 (byte) 0xB7, (byte) 0x52, (byte) 0x0F, (byte) 0x68 |
128 (byte) 0xB7, (byte) 0x52, (byte) 0x0F, (byte) 0x68 |
129 }; |
129 }; |
130 static final byte[] hash7 = new byte[] { |
130 static final byte[] hash7 = new byte[] { |
131 (byte) 0x6B, (byte) 0xA2, (byte) 0xE9, (byte) 0x8E, |
131 (byte) 0x3C, (byte) 0x03, (byte) 0xEA, (byte) 0x4A, |
132 (byte) 0xE1, (byte) 0x8E, (byte) 0x60, (byte) 0xBE, |
132 (byte) 0x62, (byte) 0xD2, (byte) 0x18, (byte) 0xE5, |
133 (byte) 0x54, (byte) 0xC4, (byte) 0x33, (byte) 0x3E, |
133 (byte) 0xA5, (byte) 0xC2, (byte) 0xB7, (byte) 0x85, |
134 (byte) 0x0C, (byte) 0x2D, (byte) 0x3A, (byte) 0x7C |
134 (byte) 0x90, (byte) 0xFA, (byte) 0x98, (byte) 0xCD |
135 }; |
135 }; |
136 static final byte[] hash8 = new byte[] { |
136 static final byte[] hash8 = new byte[] { |
137 (byte) 0x44, (byte) 0x77, (byte) 0x6E, (byte) 0x52, |
137 (byte) 0x0B, (byte) 0xEB, (byte) 0x16, (byte) 0xF5, |
138 (byte) 0x2B, (byte) 0x16, (byte) 0xD3, (byte) 0x3C, |
138 (byte) 0x7F, (byte) 0xB0, (byte) 0x18, (byte) 0xF1, |
139 (byte) 0x78, (byte) 0x75, (byte) 0xF5, (byte) 0x0A, |
139 (byte) 0x78, (byte) 0x11, (byte) 0xED, (byte) 0x30, |
140 (byte) 0x01, (byte) 0x24, (byte) 0xBD, (byte) 0x2A |
140 (byte) 0x19, (byte) 0x4D, (byte) 0xDE, (byte) 0x8A |
141 }; |
141 }; |
142 |
142 |
143 final static Map<String, byte[]> version2Hash = new HashMap<>(); |
143 final static Map<String, byte[]> version2Hash = new HashMap<>(); |
144 |
144 |
145 static { |
145 static { |
407 analyzeElement(e); |
407 analyzeElement(e); |
408 out.write(String.valueOf(e.getDefaultValue())); |
408 out.write(String.valueOf(e.getDefaultValue())); |
409 for (VariableElement param : e.getParameters()) { |
409 for (VariableElement param : e.getParameters()) { |
410 visit(param, p); |
410 visit(param, p); |
411 } |
411 } |
412 out.write(String.valueOf(e.getReceiverType())); |
412 out.write(String.valueOf(typeMirrorTranslate(e.getReceiverType()))); |
413 write(e.getReturnType()); |
413 write(e.getReturnType()); |
414 out.write(e.getSimpleName().toString()); |
414 out.write(e.getSimpleName().toString()); |
415 writeTypes(e.getThrownTypes()); |
415 writeTypes(e.getThrownTypes()); |
416 for (TypeParameterElement param : e.getTypeParameters()) { |
416 for (TypeParameterElement param : e.getTypeParameters()) { |
417 visit(param, p); |
417 visit(param, p); |
421 out.write("\n"); |
421 out.write("\n"); |
422 } catch (IOException ex) { |
422 } catch (IOException ex) { |
423 ex.printStackTrace(); |
423 ex.printStackTrace(); |
424 } |
424 } |
425 return null; |
425 return null; |
|
426 } |
|
427 |
|
428 /** |
|
429 * Original implementation of getReceiverType returned null |
|
430 * for many cases where TypeKind.NONE was specified; translate |
|
431 * back to null to compare against old hashes. |
|
432 */ |
|
433 private TypeMirror typeMirrorTranslate(TypeMirror type) { |
|
434 if (type.getKind() == javax.lang.model.type.TypeKind.NONE) |
|
435 return null; |
|
436 else |
|
437 return type; |
426 } |
438 } |
427 |
439 |
428 @Override |
440 @Override |
429 public Void visitPackage(PackageElement e, Void p) { |
441 public Void visitPackage(PackageElement e, Void p) { |
430 List<Element> types = new ArrayList<>(e.getEnclosedElements()); |
442 List<Element> types = new ArrayList<>(e.getEnclosedElements()); |