1 /* 2 * Copyright 2023 Code Intelligence GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.code_intelligence.jazzer.mutation.annotation.proto; 18 19 import static java.lang.annotation.ElementType.TYPE_USE; 20 import static java.lang.annotation.RetentionPolicy.RUNTIME; 21 22 import com.code_intelligence.jazzer.mutation.annotation.AppliesTo; 23 import com.google.protobuf.DynamicMessage; 24 import com.google.protobuf.Message; 25 import java.lang.annotation.Retention; 26 import java.lang.annotation.Target; 27 28 /** 29 * Provides a default instance to use as the base for mutations of the annotated {@link Message} or 30 * {@link DynamicMessage.Builder}. 31 */ 32 @Target(TYPE_USE) 33 @Retention(RUNTIME) 34 @AppliesTo(subClassesOf = {Message.class, Message.Builder.class}) 35 public @interface WithDefaultInstance { 36 /** 37 * The fully qualified name of a static method (e.g. 38 * {@code com.example.MyClass#getDefaultInstance}) with return type assignable to 39 * {@link com.google.protobuf.Message}, which returns a default instance that mutations should be 40 * based on. 41 */ value()42 String value(); 43 } 44