1 /** 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 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 #include "annotation_data_accessor.h" 16 #include "class_data_accessor.h" 17 #include "ets_panda_file_items.h" 18 #include "ets_vm.h" 19 #include "file.h" 20 #include "include/managed_thread.h" 21 #include "include/object_header.h" 22 #include "plugins/ets/runtime/types/ets_field.h" 23 #include "types/ets_object.h" 24 #include "types/ets_primitives.h" 25 26 namespace ark::ets::intrinsics { 27 IsLiteralInitializedInterfaceImpl(EtsObject * target)28extern "C" EtsBoolean IsLiteralInitializedInterfaceImpl(EtsObject *target) 29 { 30 [[maybe_unused]] HandleScope<ObjectHeader *> scope(ManagedThread::GetCurrent()); 31 32 auto *etsClass = target->GetClass(); 33 auto *runtimeClass = etsClass->GetRuntimeClass(); 34 const panda_file::File &pf = *runtimeClass->GetPandaFile(); 35 panda_file::ClassDataAccessor cda(pf, runtimeClass->GetFileId()); 36 bool retBoolVal = false; 37 38 cda.EnumerateAnnotation(panda_file_items::class_descriptors::INTERFACE_OBJ_LITERAL.data(), 39 [&retBoolVal](panda_file::AnnotationDataAccessor &) { 40 retBoolVal = true; 41 return true; 42 }); 43 44 return ToEtsBoolean(retBoolVal); 45 } 46 47 } // namespace ark::ets::intrinsics 48