|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2007, 2013 IBM Corporation and others. |
2 |
* Copyright (c) 2007, 2016 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 29-34
Link Here
|
| 29 |
import java.io.StringReader; |
29 |
import java.io.StringReader; |
| 30 |
import java.io.UnsupportedEncodingException; |
30 |
import java.io.UnsupportedEncodingException; |
| 31 |
import java.lang.reflect.Field; |
31 |
import java.lang.reflect.Field; |
|
|
32 |
import java.lang.reflect.Modifier; |
| 32 |
import java.nio.ByteBuffer; |
33 |
import java.nio.ByteBuffer; |
| 33 |
import java.nio.CharBuffer; |
34 |
import java.nio.CharBuffer; |
| 34 |
import java.nio.charset.Charset; |
35 |
import java.nio.charset.Charset; |
|
Lines 141-146
Link Here
|
| 141 |
public static final String DOT_TAR_GZ = ".tar.gz"; //$NON-NLS-1$ |
142 |
public static final String DOT_TAR_GZ = ".tar.gz"; //$NON-NLS-1$ |
| 142 |
public static final String DOT_JAR = ".jar"; //$NON-NLS-1$ |
143 |
public static final String DOT_JAR = ".jar"; //$NON-NLS-1$ |
| 143 |
public static final String DOT_ZIP = ".zip"; //$NON-NLS-1$ |
144 |
public static final String DOT_ZIP = ".zip"; //$NON-NLS-1$ |
|
|
145 |
public static Map<Integer, String> flagsNames = new HashMap<>(); |
| 146 |
|
| 147 |
static { |
| 148 |
Field[] declaredFields = IDelta.class.getDeclaredFields(); |
| 149 |
for (Field field : declaredFields) { |
| 150 |
try { |
| 151 |
if (Modifier.isFinal(field.getModifiers()) && Modifier.isStatic(field.getModifiers()) && Modifier.isPublic(field.getModifiers())) { |
| 152 |
Integer value = Integer.valueOf(field.getInt(null)); |
| 153 |
flagsNames.put(value, field.getName()); |
| 154 |
} |
| 155 |
} catch (IllegalAccessException e) { |
| 156 |
// ignore |
| 157 |
} |
| 158 |
} |
| 159 |
} |
| 144 |
|
160 |
|
| 145 |
public static final char VERSION_SEPARATOR = '('; |
161 |
public static final char VERSION_SEPARATOR = '('; |
| 146 |
|
162 |
|
|
Lines 687-692
Link Here
|
| 687 |
} |
703 |
} |
| 688 |
|
704 |
|
| 689 |
/** |
705 |
/** |
|
|
706 |
* Return an int value that represents the given flag value. Returns -1 if |
| 707 |
* the flag value cannot be determined. |
| 708 |
* |
| 709 |
* @param flagName the given element type |
| 710 |
* @return an int that represents the given flag value constant. |
| 711 |
*/ |
| 712 |
public static int getDeltaFlagValue(String flagName) { |
| 713 |
Class<IDelta> IDeltaClass = IDelta.class; |
| 714 |
try { |
| 715 |
Field field = IDeltaClass.getField(flagName); |
| 716 |
return field.getInt(null); |
| 717 |
} catch (SecurityException e) { |
| 718 |
// ignore |
| 719 |
} catch (IllegalArgumentException e) { |
| 720 |
// ignore |
| 721 |
} catch (NoSuchFieldException e) { |
| 722 |
// ignore |
| 723 |
} catch (IllegalAccessException e) { |
| 724 |
// ignore |
| 725 |
} |
| 726 |
return -1; |
| 727 |
} |
| 728 |
|
| 729 |
/** |
| 690 |
* Return a string that represents the given element type Returns |
730 |
* Return a string that represents the given element type Returns |
| 691 |
* {@link #UNKNOWN_ELEMENT_KIND} if the element type cannot be determined. |
731 |
* {@link #UNKNOWN_ELEMENT_KIND} if the element type cannot be determined. |
| 692 |
* |
732 |
* |
|
Lines 729-869
Link Here
|
| 729 |
* @return a string that represents the given flags. |
769 |
* @return a string that represents the given flags. |
| 730 |
*/ |
770 |
*/ |
| 731 |
public static String getDeltaFlagsName(int flags) { |
771 |
public static String getDeltaFlagsName(int flags) { |
| 732 |
switch (flags) { |
772 |
String fieldName = flagsNames.get(Integer.valueOf(flags)); |
| 733 |
case IDelta.ABSTRACT_TO_NON_ABSTRACT: |
773 |
if (fieldName != null) { |
| 734 |
return "ABSTRACT_TO_NON_ABSTRACT"; //$NON-NLS-1$ |
774 |
return fieldName; |
| 735 |
case IDelta.ANNOTATION_DEFAULT_VALUE: |
|
|
| 736 |
return "ANNOTATION_DEFAULT_VALUE"; //$NON-NLS-1$ |
| 737 |
case IDelta.API_COMPONENT: |
| 738 |
return "API_COMPONENT"; //$NON-NLS-1$ |
| 739 |
case IDelta.ARRAY_TO_VARARGS: |
| 740 |
return "ARRAY_TO_VARARGS"; //$NON-NLS-1$ |
| 741 |
case IDelta.CHECKED_EXCEPTION: |
| 742 |
return "CHECKED_EXCEPTION"; //$NON-NLS-1$ |
| 743 |
case IDelta.CLASS_BOUND: |
| 744 |
return "CLASS_BOUND"; //$NON-NLS-1$ |
| 745 |
case IDelta.CLINIT: |
| 746 |
return "CLINIT"; //$NON-NLS-1$ |
| 747 |
case IDelta.CONSTRUCTOR: |
| 748 |
return "CONSTRUCTOR"; //$NON-NLS-1$ |
| 749 |
case IDelta.CONTRACTED_SUPERINTERFACES_SET: |
| 750 |
return "CONTRACTED_SUPERINTERFACES_SET"; //$NON-NLS-1$ |
| 751 |
case IDelta.DECREASE_ACCESS: |
| 752 |
return "DECREASE_ACCESS"; //$NON-NLS-1$ |
| 753 |
case IDelta.ENUM_CONSTANT: |
| 754 |
return "ENUM_CONSTANT"; //$NON-NLS-1$ |
| 755 |
case IDelta.EXECUTION_ENVIRONMENT: |
| 756 |
return "EXECUTION_ENVIRONMENT"; //$NON-NLS-1$ |
| 757 |
case IDelta.EXPANDED_SUPERINTERFACES_SET: |
| 758 |
return "EXPANDED_SUPERINTERFACES_SET"; //$NON-NLS-1$ |
| 759 |
case IDelta.FIELD: |
| 760 |
return "FIELD"; //$NON-NLS-1$ |
| 761 |
case IDelta.FIELD_MOVED_UP: |
| 762 |
return "FIELD_MOVED_UP"; //$NON-NLS-1$ |
| 763 |
case IDelta.FINAL_TO_NON_FINAL: |
| 764 |
return "FINAL_TO_NON_FINAL"; //$NON-NLS-1$ |
| 765 |
case IDelta.FINAL_TO_NON_FINAL_NON_STATIC: |
| 766 |
return "FINAL_TO_NON_FINAL_NON_STATIC"; //$NON-NLS-1$ |
| 767 |
case IDelta.FINAL_TO_NON_FINAL_STATIC_CONSTANT: |
| 768 |
return "FINAL_TO_NON_FINAL_STATIC_CONSTANT"; //$NON-NLS-1$ |
| 769 |
case IDelta.FINAL_TO_NON_FINAL_STATIC_NON_CONSTANT: |
| 770 |
return "FINAL_TO_NON_FINAL_STATIC_NON_CONSTANT"; //$NON-NLS-1$ |
| 771 |
case IDelta.INCREASE_ACCESS: |
| 772 |
return "INCREASE_ACCESS"; //$NON-NLS-1$ |
| 773 |
case IDelta.INTERFACE_BOUND: |
| 774 |
return "INTERFACE_BOUND"; //$NON-NLS-1$ |
| 775 |
case IDelta.METHOD: |
| 776 |
return "METHOD"; //$NON-NLS-1$ |
| 777 |
case IDelta.METHOD_MOVED_UP: |
| 778 |
return "METHOD_MOVED_UP"; //$NON-NLS-1$ |
| 779 |
case IDelta.METHOD_WITH_DEFAULT_VALUE: |
| 780 |
return "METHOD_WITH_DEFAULT_VALUE"; //$NON-NLS-1$ |
| 781 |
case IDelta.METHOD_WITHOUT_DEFAULT_VALUE: |
| 782 |
return "METHOD_WITHOUT_DEFAULT_VALUE"; //$NON-NLS-1$ |
| 783 |
case IDelta.NATIVE_TO_NON_NATIVE: |
| 784 |
return "NATIVE_TO_NON_NATIVE"; //$NON-NLS-1$ |
| 785 |
case IDelta.NON_ABSTRACT_TO_ABSTRACT: |
| 786 |
return "NON_ABSTRACT_TO_ABSTRACT"; //$NON-NLS-1$ |
| 787 |
case IDelta.NON_FINAL_TO_FINAL: |
| 788 |
return "NON_FINAL_TO_FINAL"; //$NON-NLS-1$ |
| 789 |
case IDelta.NON_NATIVE_TO_NATIVE: |
| 790 |
return "NON_NATIVE_TO_NATIVE"; //$NON-NLS-1$ |
| 791 |
case IDelta.NON_STATIC_TO_STATIC: |
| 792 |
return "NON_STATIC_TO_STATIC"; //$NON-NLS-1$ |
| 793 |
case IDelta.NON_SYNCHRONIZED_TO_SYNCHRONIZED: |
| 794 |
return "NON_SYNCHRONIZED_TO_SYNCHRONIZED"; //$NON-NLS-1$ |
| 795 |
case IDelta.NON_TRANSIENT_TO_TRANSIENT: |
| 796 |
return "NON_TRANSIENT_TO_TRANSIENT"; //$NON-NLS-1$ |
| 797 |
case IDelta.OVERRIDEN_METHOD: |
| 798 |
return "OVERRIDEN_METHOD"; //$NON-NLS-1$ |
| 799 |
case IDelta.STATIC_TO_NON_STATIC: |
| 800 |
return "STATIC_TO_NON_STATIC"; //$NON-NLS-1$ |
| 801 |
case IDelta.SUPERCLASS: |
| 802 |
return "SUPERCLASS"; //$NON-NLS-1$ |
| 803 |
case IDelta.SYNCHRONIZED_TO_NON_SYNCHRONIZED: |
| 804 |
return "SYNCHRONIZED_TO_NON_SYNCHRONIZED"; //$NON-NLS-1$ |
| 805 |
case IDelta.TYPE_CONVERSION: |
| 806 |
return "TYPE_CONVERSION"; //$NON-NLS-1$ |
| 807 |
case IDelta.TRANSIENT_TO_NON_TRANSIENT: |
| 808 |
return "TRANSIENT_TO_NON_TRANSIENT"; //$NON-NLS-1$ |
| 809 |
case IDelta.TYPE: |
| 810 |
return "TYPE"; //$NON-NLS-1$ |
| 811 |
case IDelta.TYPE_ARGUMENTS: |
| 812 |
return "TYPE_ARGUMENTS"; //$NON-NLS-1$ |
| 813 |
case IDelta.TYPE_MEMBER: |
| 814 |
return "TYPE_MEMBER"; //$NON-NLS-1$ |
| 815 |
case IDelta.TYPE_PARAMETER: |
| 816 |
return "TYPE_PARAMETER"; //$NON-NLS-1$ |
| 817 |
case IDelta.TYPE_PARAMETER_NAME: |
| 818 |
return "TYPE_PARAMETER_NAME"; //$NON-NLS-1$ |
| 819 |
case IDelta.TYPE_PARAMETERS: |
| 820 |
return "TYPE_PARAMETERS"; //$NON-NLS-1$ |
| 821 |
case IDelta.TYPE_VISIBILITY: |
| 822 |
return "TYPE_VISIBILITY"; //$NON-NLS-1$ |
| 823 |
case IDelta.UNCHECKED_EXCEPTION: |
| 824 |
return "UNCHECKED_EXCEPTION"; //$NON-NLS-1$ |
| 825 |
case IDelta.VALUE: |
| 826 |
return "VALUE"; //$NON-NLS-1$ |
| 827 |
case IDelta.VARARGS_TO_ARRAY: |
| 828 |
return "VARARGS_TO_ARRAY"; //$NON-NLS-1$ |
| 829 |
case IDelta.RESTRICTIONS: |
| 830 |
return "RESTRICTIONS"; //$NON-NLS-1$ |
| 831 |
case IDelta.API_TYPE: |
| 832 |
return "API_TYPE"; //$NON-NLS-1$ |
| 833 |
case IDelta.NON_VOLATILE_TO_VOLATILE: |
| 834 |
return "NON_VOLATILE_TO_VOLATILE"; //$NON-NLS-1$ |
| 835 |
case IDelta.VOLATILE_TO_NON_VOLATILE: |
| 836 |
return "VOLATILE_TO_NON_VOLATILE"; //$NON-NLS-1$ |
| 837 |
case IDelta.MINOR_VERSION: |
| 838 |
return "MINOR_VERSION"; //$NON-NLS-1$ |
| 839 |
case IDelta.MAJOR_VERSION: |
| 840 |
return "MAJOR_VERSION"; //$NON-NLS-1$ |
| 841 |
case IDelta.API_FIELD: |
| 842 |
return "API_FIELD"; //$NON-NLS-1$ |
| 843 |
case IDelta.API_METHOD: |
| 844 |
return "API_METHOD"; //$NON-NLS-1$ |
| 845 |
case IDelta.API_CONSTRUCTOR: |
| 846 |
return "API_CONSTRUCTOR"; //$NON-NLS-1$ |
| 847 |
case IDelta.API_ENUM_CONSTANT: |
| 848 |
return "API_ENUM_CONSTANT"; //$NON-NLS-1$ |
| 849 |
case IDelta.API_METHOD_WITH_DEFAULT_VALUE: |
| 850 |
return "API_METHOD_WITH_DEFAULT_VALUE"; //$NON-NLS-1$ |
| 851 |
case IDelta.API_METHOD_WITHOUT_DEFAULT_VALUE: |
| 852 |
return "API_METHOD_WITHOUT_DEFAULT_VALUE"; //$NON-NLS-1$ |
| 853 |
case IDelta.TYPE_ARGUMENT: |
| 854 |
return "TYPE_ARGUMENT"; //$NON-NLS-1$ |
| 855 |
case IDelta.SUPER_INTERFACE_WITH_METHODS: |
| 856 |
return "SUPER_INTERFACE_WITH_METHODS"; //$NON-NLS-1$ |
| 857 |
case IDelta.REEXPORTED_API_TYPE: |
| 858 |
return "REEXPORTED_API_TYPE"; //$NON-NLS-1$ |
| 859 |
case IDelta.REEXPORTED_TYPE: |
| 860 |
return "REEXPORTED_TYPE"; //$NON-NLS-1$ |
| 861 |
case IDelta.METHOD_MOVED_DOWN: |
| 862 |
return "METHOD_MOVED_DOWN"; //$NON-NLS-1$ |
| 863 |
case IDelta.DEPRECATION: |
| 864 |
return "DEPRECATION"; //$NON-NLS-1$ |
| 865 |
default: |
| 866 |
break; |
| 867 |
} |
775 |
} |
| 868 |
return UNKNOWN_FLAGS; |
776 |
return UNKNOWN_FLAGS; |
| 869 |
} |
777 |
} |
|
Lines 1371-1377
Link Here
|
| 1371 |
/** |
1279 |
/** |
| 1372 |
* Rewrite a parameter type signature with type erasure and using the |
1280 |
* Rewrite a parameter type signature with type erasure and using the |
| 1373 |
* parameterized type bounds lookup table. For example: |
1281 |
* parameterized type bounds lookup table. For example: |
| 1374 |
* |
1282 |
* |
| 1375 |
* <pre> |
1283 |
* <pre> |
| 1376 |
* expand("QList<QE;>;", {"E" → "Ljava.lang.Object;"}) = "QList;" |
1284 |
* expand("QList<QE;>;", {"E" → "Ljava.lang.Object;"}) = "QList;" |
| 1377 |
* expand("QE;", {"E" → "Ljava.lang.Object;"}) = "Ljava.lang.Object;" |
1285 |
* expand("QE;", {"E" → "Ljava.lang.Object;"}) = "Ljava.lang.Object;" |
|
Lines 2343-2350
Link Here
|
| 2343 |
default: |
2251 |
default: |
| 2344 |
return arguments[0]; |
2252 |
return arguments[0]; |
| 2345 |
} |
2253 |
} |
|
|
2254 |
case IDelta.EXECUTION_ENVIRONMENT: |
| 2255 |
StringBuilder builder = new StringBuilder(); |
| 2256 |
int i = 0; |
| 2257 |
for (String argument : arguments) { |
| 2258 |
if (i != 0) { |
| 2259 |
builder.append(','); |
| 2260 |
} |
| 2261 |
builder.append(argument); |
| 2262 |
i++; |
| 2263 |
} |
| 2264 |
return String.valueOf(builder); |
| 2346 |
default: |
2265 |
default: |
| 2347 |
break; |
|
|
| 2348 |
} |
2266 |
} |
| 2349 |
return EMPTY_STRING; |
2267 |
return EMPTY_STRING; |
| 2350 |
} |
2268 |
} |