1 // Copyright 2021 Code Intelligence GmbH 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package com.code_intelligence.jazzer.autofuzz; 16 17 import java.io.Closeable; 18 import java.io.IOException; 19 import java.io.Serializable; 20 import java.util.Arrays; 21 import java.util.List; 22 import java.util.Map; 23 import java.util.Objects; 24 25 // Returned by Meta when asked to construct a Class object. Its purpose is to be a relatively 26 // "interesting" Java data class that can serve as the target of methods that perform some kind of 27 // reflection or deserialization. 28 public class YourAverageJavaClass implements Cloneable, Closeable, Serializable { 29 public byte aByte; 30 public boolean aBoolean; 31 public double aDouble; 32 public float aFloat; 33 public int anInt; 34 public transient int transientInt; 35 public long aLong; 36 public short aShort; 37 public volatile short volatileShort; 38 public String string; 39 public byte[] bytes; 40 public List<YourAverageJavaClass> list; 41 public Map<String, YourAverageJavaClass> map; 42 43 // Everything below has been automatically generated (apart from a minor modification to clone()); 44 YourAverageJavaClass(byte aByte, boolean aBoolean, double aDouble, float aFloat, int anInt, int transientInt, long aLong, short aShort, short volatileShort, String string)45 public YourAverageJavaClass(byte aByte, boolean aBoolean, double aDouble, float aFloat, int anInt, 46 int transientInt, long aLong, short aShort, short volatileShort, String string) { 47 this.aByte = aByte; 48 this.aBoolean = aBoolean; 49 this.aDouble = aDouble; 50 this.aFloat = aFloat; 51 this.anInt = anInt; 52 this.transientInt = transientInt; 53 this.aLong = aLong; 54 this.aShort = aShort; 55 this.volatileShort = volatileShort; 56 this.string = string; 57 } 58 YourAverageJavaClass()59 public YourAverageJavaClass() {} 60 YourAverageJavaClass(byte aByte, boolean aBoolean, double aDouble, float aFloat, int anInt, int transientInt, long aLong, short aShort, short volatileShort, String string, byte[] bytes, List<YourAverageJavaClass> list, Map<String, YourAverageJavaClass> map)61 public YourAverageJavaClass(byte aByte, boolean aBoolean, double aDouble, float aFloat, int anInt, 62 int transientInt, long aLong, short aShort, short volatileShort, String string, byte[] bytes, 63 List<YourAverageJavaClass> list, Map<String, YourAverageJavaClass> map) { 64 this.aByte = aByte; 65 this.aBoolean = aBoolean; 66 this.aDouble = aDouble; 67 this.aFloat = aFloat; 68 this.anInt = anInt; 69 this.transientInt = transientInt; 70 this.aLong = aLong; 71 this.aShort = aShort; 72 this.volatileShort = volatileShort; 73 this.string = string; 74 this.bytes = bytes; 75 this.list = list; 76 this.map = map; 77 } 78 getaByte()79 public byte getaByte() { 80 return aByte; 81 } 82 setaByte(byte aByte)83 public void setaByte(byte aByte) { 84 this.aByte = aByte; 85 } 86 isaBoolean()87 public boolean isaBoolean() { 88 return aBoolean; 89 } 90 setaBoolean(boolean aBoolean)91 public void setaBoolean(boolean aBoolean) { 92 this.aBoolean = aBoolean; 93 } 94 getaDouble()95 public double getaDouble() { 96 return aDouble; 97 } 98 setaDouble(double aDouble)99 public void setaDouble(double aDouble) { 100 this.aDouble = aDouble; 101 } 102 getaFloat()103 public float getaFloat() { 104 return aFloat; 105 } 106 setaFloat(float aFloat)107 public void setaFloat(float aFloat) { 108 this.aFloat = aFloat; 109 } 110 getAnInt()111 public int getAnInt() { 112 return anInt; 113 } 114 setAnInt(int anInt)115 public void setAnInt(int anInt) { 116 this.anInt = anInt; 117 } 118 getTransientInt()119 public int getTransientInt() { 120 return transientInt; 121 } 122 setTransientInt(int transientInt)123 public void setTransientInt(int transientInt) { 124 this.transientInt = transientInt; 125 } 126 getaLong()127 public long getaLong() { 128 return aLong; 129 } 130 setaLong(long aLong)131 public void setaLong(long aLong) { 132 this.aLong = aLong; 133 } 134 getaShort()135 public short getaShort() { 136 return aShort; 137 } 138 setaShort(short aShort)139 public void setaShort(short aShort) { 140 this.aShort = aShort; 141 } 142 getVolatileShort()143 public short getVolatileShort() { 144 return volatileShort; 145 } 146 setVolatileShort(short volatileShort)147 public void setVolatileShort(short volatileShort) { 148 this.volatileShort = volatileShort; 149 } 150 getString()151 public String getString() { 152 return string; 153 } 154 setString(String string)155 public void setString(String string) { 156 this.string = string; 157 } 158 getBytes()159 public byte[] getBytes() { 160 return bytes; 161 } 162 setBytes(byte[] bytes)163 public void setBytes(byte[] bytes) { 164 this.bytes = bytes; 165 } 166 getList()167 public List<YourAverageJavaClass> getList() { 168 return list; 169 } 170 setList(List<YourAverageJavaClass> list)171 public void setList(List<YourAverageJavaClass> list) { 172 this.list = list; 173 } 174 getMap()175 public Map<String, YourAverageJavaClass> getMap() { 176 return map; 177 } 178 setMap(Map<String, YourAverageJavaClass> map)179 public void setMap(Map<String, YourAverageJavaClass> map) { 180 this.map = map; 181 } 182 183 @Override clone()184 public YourAverageJavaClass clone() { 185 try { 186 YourAverageJavaClass clone = (YourAverageJavaClass) super.clone(); 187 clone.transientInt = transientInt + 1; 188 clone.volatileShort = (short) (volatileShort - 1); 189 return clone; 190 } catch (CloneNotSupportedException e) { 191 throw new AssertionError(); 192 } 193 } 194 195 @Override equals(Object o)196 public boolean equals(Object o) { 197 if (this == o) 198 return true; 199 if (!(o instanceof YourAverageJavaClass)) 200 return false; 201 YourAverageJavaClass that = (YourAverageJavaClass) o; 202 return aByte == that.aByte && aBoolean == that.aBoolean 203 && Double.compare(that.aDouble, aDouble) == 0 && Float.compare(that.aFloat, aFloat) == 0 204 && anInt == that.anInt && transientInt == that.transientInt && aLong == that.aLong 205 && aShort == that.aShort && volatileShort == that.volatileShort 206 && Objects.equals(string, that.string) && Arrays.equals(bytes, that.bytes) 207 && Objects.equals(list, that.list) && Objects.equals(map, that.map); 208 } 209 210 @Override hashCode()211 public int hashCode() { 212 int result = Objects.hash(aByte, aBoolean, aDouble, aFloat, anInt, transientInt, aLong, aShort, 213 volatileShort, string, list, map); 214 result = 31 * result + Arrays.hashCode(bytes); 215 return result; 216 } 217 218 @Override toString()219 public String toString() { 220 return "YourAverageJavaClass{" 221 + "aByte=" + aByte + ", aBoolean=" + aBoolean + ", aDouble=" + aDouble + ", aFloat=" 222 + aFloat + ", anInt=" + anInt + ", transientInt=" + transientInt + ", aLong=" + aLong 223 + ", aShort=" + aShort + ", volatileShort=" + volatileShort + ", string='" + string + '\'' 224 + ", bytes=" + Arrays.toString(bytes) + ", list=" + list + ", map=" + map + '}'; 225 } 226 227 @Override close()228 public void close() throws IOException {} 229 } 230