001 /* 002 * Copyright 2010-2015 JetBrains s.r.o. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.jetbrains.kotlin.codegen; 018 019 public class ClassBuilderMode { 020 public final boolean generateBodies; 021 public final boolean generateMetadata; 022 public final boolean generateSourceRetentionAnnotations; 023 024 private ClassBuilderMode(boolean generateBodies, boolean generateMetadata, boolean generateSourceRetentionAnnotations) { 025 this.generateBodies = generateBodies; 026 this.generateMetadata = generateMetadata; 027 this.generateSourceRetentionAnnotations = generateSourceRetentionAnnotations; 028 } 029 030 public static ClassBuilderMode full(boolean generateSourceRetentionAnnotations) { 031 return generateSourceRetentionAnnotations ? KAPT2 : FULL; 032 } 033 034 /** 035 * Full function bodies 036 */ 037 private final static ClassBuilderMode FULL = new ClassBuilderMode( 038 /* bodies = */ true, 039 /* metadata = */ true, 040 /* sourceRetention = */ false); 041 042 /** 043 * Full function bodies, write annotations with the "source" retention. 044 */ 045 private final static ClassBuilderMode KAPT2 = new ClassBuilderMode( 046 /* bodies = */ true, 047 /* metadata = */ true, 048 /* sourceRetention = */ true); 049 050 /** 051 * Generating light classes: Only function signatures 052 */ 053 public final static ClassBuilderMode LIGHT_CLASSES = new ClassBuilderMode( 054 /* bodies = */ false, 055 /* metadata = */ false, 056 /* sourceRetention = */ true); 057 058 /** 059 * Function signatures + metadata (to support incremental compilation with kapt) 060 */ 061 public final static ClassBuilderMode KAPT = new ClassBuilderMode( 062 /* bodies = */ false, 063 /* metadata = */ true, 064 /* sourceRetention = */ true); 065 }