<commit_before>/**
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.devtools.cdbg.debuglets.java;

import static com.google.devtools.cdbg.debuglets.java.AgentLogger.warnfmt;

import java.io.IOException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Objects;
/**
 * Ensures safety of application methods invoked by the debuglet.
 *
 * <p>This is a singleton class. It needs to be initialized before it can be used.
 *
 * <p>The debugger does not allow calling methods that can change the state of the application. This
 * would break the fundamental assumption that Cloud Debugger provides a "read-only" experience.
 *
 * <p>The safety is guaranteed by these techniques:
 * <ul>
 * <li>The method is whitelisted as knowingly safe (e.g. {@link String#format}).
 * <li>The method is statically verified to be safe (e.g. simple getters).
 * <li>The method bytecode is transformed into one that asserts no side effects at runtime.
 * </ul>
 *
 * <p>This class is thread safe.<commit_msg>Fix open-source build break. The move in CL/127547874 moved the import to a block stripped off by MOE.<commit_after>/**
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.devtools.cdbg.debuglets.java;

import static com.google.devtools.cdbg.debuglets.java.AgentLogger.warnfmt;

import java.io.IOException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Objects;
import org.objectweb.asm.Type;

/**
 * Ensures safety of application methods invoked by the debuglet.
 *
 * <p>This is a singleton class. It needs to be initialized before it can be used.
 *
 * <p>The debugger does not allow calling methods that can change the state of the application. This
 * would break the fundamental assumption that Cloud Debugger provides a "read-only" experience.
 *
 * <p>The safety is guaranteed by these techniques:
 * <ul>
 * <li>The method is whitelisted as knowingly safe (e.g. {@link String#format}).
 * <li>The method is statically verified to be safe (e.g. simple getters).
 * <li>The method bytecode is transformed into one that asserts no side effects at runtime.
 * </ul>
 *
 * <p>This class is thread safe.
{'fraction_non_alphanumeric': 0.08365019011406843, 'fraction_numerical': 0.007312079555425563, 'mean_word_length': 4.074183976261128, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '835533', 'n_tokens_mistral': 931, 'n_tokens_neox': 907, 'n_words': 422}